* dt-validate crash on <foo>-gpio
@ 2023-12-11 12:59 Geert Uytterhoeven
2023-12-12 23:18 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2023-12-11 12:59 UTC (permalink / raw)
To: Rob Herring
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux-Renesas
Hi Rob,
When running "make dtbs_check" on a DTB in the Renesas BSP, I ran into
the following backtrace:
Traceback (most recent call last):
File "dt-validate", line 8, in <module>
sys.exit(main())
File "dt-schema/dtschema/dtb_validate.py", line 144, in main
sg.check_dtb(filename)
File "dt-schema/dtschema/dtb_validate.py", line 87, in check_dtb
dt = self.validator.decode_dtb(f.read())
File "dt-schema/dtschema/validator.py", line 491, in decode_dtb
return [dtschema.dtb.fdt_unflatten(self, dtb)]
File "dt-schema/dtschema/dtb.py", line 483, in fdt_unflatten
fixup_gpios(dt)
File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
fixup_gpios(v)
File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
fixup_gpios(v)
File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
fixup_gpios(v)
File "dt-schema/dtschema/dtb.py", line 378, in fixup_gpios
val = v[0]
TypeError: 'bool' object is not subscriptable
Turns out the issue is triggered by the presence of a (non-documented)
boolean "no-use-gpio" property.
Apparently anything that matches "*-gpio" is treated as having a list of
GPIO specifiers, causing a crash if that does not turn out to be true...
While the introduction of a "no-use-gpio" boolean property might not
survive public review, it would be good if the tooling wouldn't crash
on it.
Thanks!
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] 2+ messages in thread* Re: dt-validate crash on <foo>-gpio
2023-12-11 12:59 dt-validate crash on <foo>-gpio Geert Uytterhoeven
@ 2023-12-12 23:18 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2023-12-12 23:18 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux-Renesas
On Mon, Dec 11, 2023 at 01:59:43PM +0100, Geert Uytterhoeven wrote:
> Hi Rob,
>
> When running "make dtbs_check" on a DTB in the Renesas BSP, I ran into
> the following backtrace:
>
> Traceback (most recent call last):
> File "dt-validate", line 8, in <module>
> sys.exit(main())
> File "dt-schema/dtschema/dtb_validate.py", line 144, in main
> sg.check_dtb(filename)
> File "dt-schema/dtschema/dtb_validate.py", line 87, in check_dtb
> dt = self.validator.decode_dtb(f.read())
> File "dt-schema/dtschema/validator.py", line 491, in decode_dtb
> return [dtschema.dtb.fdt_unflatten(self, dtb)]
> File "dt-schema/dtschema/dtb.py", line 483, in fdt_unflatten
> fixup_gpios(dt)
> File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
> fixup_gpios(v)
> File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
> fixup_gpios(v)
> File "dt-schema/dtschema/dtb.py", line 373, in fixup_gpios
> fixup_gpios(v)
> File "dt-schema/dtschema/dtb.py", line 378, in fixup_gpios
> val = v[0]
> TypeError: 'bool' object is not subscriptable
>
> Turns out the issue is triggered by the presence of a (non-documented)
> boolean "no-use-gpio" property.
>
> Apparently anything that matches "*-gpio" is treated as having a list of
> GPIO specifiers, causing a crash if that does not turn out to be true...
> While the introduction of a "no-use-gpio" boolean property might not
> survive public review, it would be good if the tooling wouldn't crash
> on it.
Seems like good discouragement on using unreviewed properties. ;) I'll
make a fix.
In the future, use anything but devicetree@vger for this kind of issue.
GH issue, devicetree-spec@vger, IRC are easier for me to see.
Rob
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-12 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 12:59 dt-validate crash on <foo>-gpio Geert Uytterhoeven
2023-12-12 23:18 ` Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox