Re: [PATCH] checks: Avoid warnings for reg override in __overlay__

Rob Herring <[email protected]> Wed, 17 Jun 2026 17:54:42 -0500
Newsgroups org.kernel.vger.devicetree-compiler
Message-ID <CAL_Jsq++ERWJ19BcVXHKTzq1PN7tpJm=rm6e08UCH_gcp6ncHg@mail.gmail.com>
On Wed, Jun 17, 2026 at 3:44=E2=80=AFPM Brian Norris <briannorris@chromium.=
org> wrote:
>
> A simple overlay case can hit a number of false warnings just because it
> provides a 'reg' property [1]:
>
>  * avoid_default_addr_size: the generated fragment@0 node is an
>    artificial node, where #address-cells/#size-cells can't exist.
>
>  * reg_format: we're assuming the wrong/default #address-cells here, so
>    the analysis is wrong. (We don't know how many cells should be in
>    this 'reg', in isolation.)
>
>  * unit_address_vs_reg: we don't know the real node name here. (It's not
>    actually going to be "__overlay__".)
>
> All these cannot be checked by the overlay compiler in isolation.
> Suppress them when we identify we're running in plugin mode, and we're
> likely looking at a generated __overlay__ hierarchy that can't be
> analyzed in this way.
>
> [1]
> $ dtc -I dts -O dts tests/overlay-reg-override.dtso
> tests/overlay-reg-override.dtso:5.2-14: Warning (reg_format): /fragment@0=
/__overlay__:reg: property has invalid length (4 bytes) (#address-cells =3D=
=3D 2, #size-cells =3D=3D 1)
> tests/overlay-reg-override.dtso:4.6-6.3: Warning (unit_address_vs_reg): /=
fragment@0/__overlay__: node has a reg or ranges property, but no unit name
> <stdout>: Warning (pci_device_reg): Failed prerequisite 'reg_format'
> <stdout>: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
> <stdout>: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
> <stdout>: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> <stdout>: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> tests/overlay-reg-override.dtso:4.6-6.3: Warning (avoid_default_addr_size=
): /fragment@0/__overlay__: Relying on default #address-cells value
> tests/overlay-reg-override.dtso:4.6-6.3: Warning (avoid_default_addr_size=
): /fragment@0/__overlay__: Relying on default #size-cells value
> <stdout>: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avo=
id_default_addr_size'
> <stdout>: Warning (unique_unit_address): Failed prerequisite 'avoid_defau=
lt_addr_size'
> /dts-v1/;
>
> / {
>
>         fragment@0 {
>                 target =3D <&foo>;
>
>                 __overlay__ {
>                         reg =3D <0x00>;

I would argue (and did the last time this came up IIRC) the overlay
should target the parent node instead and then you can put in
#address-cells and #size-cells in the overlay to make it pass checks
(and make 'reg' parsable without applying the overlay).

Rob