linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [DT-OVERLAY PATCH] of: overlay: print the offending node name on fixup failure
@ 2020-02-25 10:42 Luca Ceresoli
  2020-02-25 11:10 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Ceresoli @ 2020-02-25 10:42 UTC (permalink / raw)
  To: devicetree, Geert Uytterhoeven
  Cc: Pantelis Antoniou, Frank Rowand, Rob Herring, linux-kernel,
	Luca Ceresoli

When a DT overlay has a fixup node that is not present in the base DT
__symbols__, this error is printed:

  OF: resolver: overlay phandle fixup failed: -22
  create_overlay: Failed to create overlay (err=-22)

which does not help much in finding the node that caused the problem.

Add a debug print with the name of the fixup node that caused the
error. The new output is:

  OF: resolver: node gpio9 not found in base DT, fixup failed
  OF: resolver: overlay phandle fixup failed: -22
  create_overlay: Failed to create overlay (err=-22)

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>

---

NOTE: this patch is not for mainline!

It applies on top of the runtime overlay patches at
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git on
branch topic/overlays, currently based on v5.6-rc1. This looked like the
most up-to-date version of the overlay patches. Should there be a better
place, please let me know.
---
 drivers/of/resolver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 83c766233181..ade817407b78 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -321,8 +321,11 @@ int of_resolve_phandles(struct device_node *overlay)
 
 		err = of_property_read_string(tree_symbols,
 				prop->name, &refpath);
-		if (err)
+		if (err) {
+			pr_err("node %s not found in base DT, fixup failed",
+			       prop->name);
 			goto out;
+		}
 
 		refnode = of_find_node_by_path(refpath);
 		if (!refnode) {
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [DT-OVERLAY PATCH] of: overlay: print the offending node name on fixup failure
  2020-02-25 10:42 [DT-OVERLAY PATCH] of: overlay: print the offending node name on fixup failure Luca Ceresoli
@ 2020-02-25 11:10 ` Geert Uytterhoeven
  2020-02-25 16:44   ` Luca Ceresoli
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-02-25 11:10 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Pantelis Antoniou, Frank Rowand, Rob Herring,
	Linux Kernel Mailing List

Hi Luca,

On Tue, Feb 25, 2020 at 11:42 AM Luca Ceresoli <luca@lucaceresoli.net> wrote:
> When a DT overlay has a fixup node that is not present in the base DT
> __symbols__, this error is printed:
>
>   OF: resolver: overlay phandle fixup failed: -22
>   create_overlay: Failed to create overlay (err=-22)
>
> which does not help much in finding the node that caused the problem.
>
> Add a debug print with the name of the fixup node that caused the
> error. The new output is:
>
>   OF: resolver: node gpio9 not found in base DT, fixup failed
>   OF: resolver: overlay phandle fixup failed: -22
>   create_overlay: Failed to create overlay (err=-22)
>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>

Thanks for your patch!

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

> NOTE: this patch is not for mainline!

Why not?

> It applies on top of the runtime overlay patches at
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git on
> branch topic/overlays, currently based on v5.6-rc1. This looked like the
> most up-to-date version of the overlay patches. Should there be a better
> place, please let me know.

Topic/overlays does not contain any changes to drivers/of/resolver.c,
so this patch is applicable to mainline, too.

> --- a/drivers/of/resolver.c
> +++ b/drivers/of/resolver.c
> @@ -321,8 +321,11 @@ int of_resolve_phandles(struct device_node *overlay)
>
>                 err = of_property_read_string(tree_symbols,
>                                 prop->name, &refpath);
> -               if (err)
> +               if (err) {
> +                       pr_err("node %s not found in base DT, fixup failed",
> +                              prop->name);
>                         goto out;
> +               }
>
>                 refnode = of_find_node_by_path(refpath);
>                 if (!refnode) {

Probably you want to print a helpful message here, too?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [DT-OVERLAY PATCH] of: overlay: print the offending node name on fixup failure
  2020-02-25 11:10 ` Geert Uytterhoeven
@ 2020-02-25 16:44   ` Luca Ceresoli
  0 siblings, 0 replies; 3+ messages in thread
From: Luca Ceresoli @ 2020-02-25 16:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Pantelis Antoniou, Frank Rowand, Rob Herring,
	Linux Kernel Mailing List

Hi Geert,

thanks for the very prompt review!

On 25/02/20 12:10, Geert Uytterhoeven wrote:
> Hi Luca,
> 
> On Tue, Feb 25, 2020 at 11:42 AM Luca Ceresoli <luca@lucaceresoli.net> wrote:
>> When a DT overlay has a fixup node that is not present in the base DT
>> __symbols__, this error is printed:
>>
>>   OF: resolver: overlay phandle fixup failed: -22
>>   create_overlay: Failed to create overlay (err=-22)
>>
>> which does not help much in finding the node that caused the problem.
>>
>> Add a debug print with the name of the fixup node that caused the
>> error. The new output is:
>>
>>   OF: resolver: node gpio9 not found in base DT, fixup failed
>>   OF: resolver: overlay phandle fixup failed: -22
>>   create_overlay: Failed to create overlay (err=-22)
>>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> 
> Thanks for your patch!
> 
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
>> NOTE: this patch is not for mainline!
> 
> Why not?

Because I'm dumb. As I'm using the non-mainlined configfs interface I
tend to consider the entire overlay code as non-mainlined too. Sending
v2 without this comment.

>> --- a/drivers/of/resolver.c
>> +++ b/drivers/of/resolver.c
>> @@ -321,8 +321,11 @@ int of_resolve_phandles(struct device_node *overlay)
>>
>>                 err = of_property_read_string(tree_symbols,
>>                                 prop->name, &refpath);
>> -               if (err)
>> +               if (err) {
>> +                       pr_err("node %s not found in base DT, fixup failed",
>> +                              prop->name);
>>                         goto out;
>> +               }
>>
>>                 refnode = of_find_node_by_path(refpath);
>>                 if (!refnode) {
> 
> Probably you want to print a helpful message here, too?

I'm doing even more. In v2 I added a specific error message for each
error path that does not have one yet, and removed the generic message
at the end.

-- 
Luca

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-25 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 10:42 [DT-OVERLAY PATCH] of: overlay: print the offending node name on fixup failure Luca Ceresoli
2020-02-25 11:10 ` Geert Uytterhoeven
2020-02-25 16:44   ` Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).