U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] libfdt: overlay: Fix missing symbols condition
Date: Sat, 17 Dec 2016 16:56:49 -0800	[thread overview]
Message-ID: <fcbf2a62d49cbdaf28c97bc5162b7698@agner.ch> (raw)
In-Reply-To: <20161216093253.j74hqpj2wihftqum@lukather>

On 2016-12-16 01:32, Maxime Ripard wrote:
> On Thu, Dec 15, 2016 at 03:03:26PM -0800, Stefan Agner wrote:
>> From: Stefan Agner <stefan.agner@toradex.com>
>>
>> When there is no symbols section in the device tree,
>> overlay_fixup_phandles should return FDT_ERR_NOTFOUND instead of
>> FDT_ERR_BADOFFSET.
>>
>> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
>> ---
>>
>>  lib/libfdt/fdt_overlay.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/libfdt/fdt_overlay.c b/lib/libfdt/fdt_overlay.c
>> index bb41404..4a9ba40 100644
>> --- a/lib/libfdt/fdt_overlay.c
>> +++ b/lib/libfdt/fdt_overlay.c
>> @@ -495,9 +495,9 @@ static int overlay_fixup_phandles(void *fdt, void *fdto)
>>  	if ((fixups_off < 0 && (fixups_off != -FDT_ERR_NOTFOUND)))
>>  		return fixups_off;
>>
>> -	/* And base DTs without symbols */
>> +	/* But if we need to fixup phandles, symbols are required */
>>  	symbols_off = fdt_path_offset(fdt, "/__symbols__");
>> -	if ((symbols_off < 0 && (symbols_off != -FDT_ERR_NOTFOUND)))
>> +	if (symbols_off < 0)
>>  		return symbols_off;
> 
> A base device tree doesn't need to have a symbols node. In the
> (uncommon, true, but still real) case where you wouldn't have any
> label in the base DT, __symbols__ wouldn't be there.

Yeah I know, but in case there are fixup offsets found (just above),
symbols get essentially mandatory.

> 
> Now, that code would return an error only if there's such a reference
> expressed in __fixups__, but no __symbols__ node that also has that
> reference. This is definitely an error but not really a NOTFOUND. You
> had an offset already, but this offset was bad. Hence the error.

It probably would a new error code?

> 
> Do you have a base DT and an overlay showing up the error you're
> trying to fix? Either way, that should be discussed with upstream's
> libfdt ml and maintainer, not (only) on U-Boot.

Yeah my problem was that my base DT had no symbols and used labels.
Wasn't aware of the whole symbols problematic...

I actually just realized that this got fixed upstream:
https://git.kernel.org/cgit/utils/dtc/dtc.git/commit/libfdt/fdt_overlay.c?id=7d8ef6e1db9794f72805a0855f4f7f12fadd03d3

I guess we could backport that fix?

--
Stefan

  reply	other threads:[~2016-12-18  0:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 23:03 [U-Boot] [PATCH 1/2] libfdt: overlay: Fix missing symbols condition Stefan Agner
2016-12-15 23:03 ` [U-Boot] [PATCH 2/2] cmd: fdt: Print error message when fdt application fails Stefan Agner
2016-12-16  9:33   ` Maxime Ripard
2016-12-17 22:48     ` Simon Glass
2017-01-14 17:14       ` Simon Glass
2016-12-16  9:32 ` [U-Boot] [PATCH 1/2] libfdt: overlay: Fix missing symbols condition Maxime Ripard
2016-12-18  0:56   ` Stefan Agner [this message]
2016-12-19 13:19     ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fcbf2a62d49cbdaf28c97bc5162b7698@agner.ch \
    --to=stefan@agner.ch \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox