Re: [RFC PATCH 05/77] fdtdump: Change FDT_PROP prob handling to ease future addition

David Gibson <[email protected]> Thu, 15 Jan 2026 11:28:45 +1100
Newsgroups org.kernel.vger.devicetree-spec,org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <aWg0va98pwR6KhQA@zatzit>
On Mon, Jan 12, 2026 at 09:11:52PM +0530, Ayush Singh wrote:
> On 1/12/26 7:48 PM, Herve Codina wrote:
> 
> > In order to ease future tags addition, perform operation related to
> > FDT_PROP when the tag is explicitly FDT_PROP instead of relying to a
> > kind of default value case.
> > 
> > Handle the FDT_PROP tag exactly in the same way as it is done for
> > other tags.
> > 
> > No functional modification.
> > 
> > Signed-off-by: Herve Codina <[email protected]>
> > ---
> >   fdtdump.c | 34 ++++++++++++++++++----------------
> >   1 file changed, 18 insertions(+), 16 deletions(-)
> > 
> > diff --git a/fdtdump.c b/fdtdump.c
> > index ec25edf..95a2274 100644
> > --- a/fdtdump.c
> > +++ b/fdtdump.c
> > @@ -129,23 +129,25 @@ static void dump_blob(void *blob, bool debug)
> >   			continue;
> >   		}
> > -		if (tag != FDT_PROP) {
> > -			fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
> > -			break;
> > +		if (tag == FDT_PROP) {
> > +			sz = fdt32_to_cpu(GET_CELL(p));
> > +			s = p_strings + fdt32_to_cpu(GET_CELL(p));
> > +			if (version < 16 && sz >= 8)
> > +				p = PALIGN(p, 8);
> > +			t = p;
> > +
> > +			p = PALIGN(p + sz, 4);
> > +
> > +			dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s);
> > +			dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off);
> > +			printf("%*s%s", depth * shift, "", s);
> > +			utilfdt_print_data(t, sz);
> > +			printf(";\n");
> > +			continue;
> >   		}
> > -		sz = fdt32_to_cpu(GET_CELL(p));
> > -		s = p_strings + fdt32_to_cpu(GET_CELL(p));
> > -		if (version < 16 && sz >= 8)
> > -			p = PALIGN(p, 8);
> > -		t = p;
> > -
> > -		p = PALIGN(p + sz, 4);
> > -
> > -		dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s);
> > -		dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off);
> > -		printf("%*s%s", depth * shift, "", s);
> > -		utilfdt_print_data(t, sz);
> > -		printf(";\n");
> > +
> > +		fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
> > +		break;
> >   	}
> >   }
> 
> 
> This seems reasonable refactor independently from the rest of the patch
> series.

Agreed.  Merged.

> Reviewed-by: Ayush Singh <[email protected]>

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmloNLwACgkQzQJF27ox
2GesXg/6A2u9+eXXCLzcoh7BsHhdoVXMNcMOQN2Je+xCd7wPdGeF1ZKpRJg6MgRY
y6x/fdT/qbtjKhAefuIrLy4pmaEeka6XjXBRg4HHKQz6xXuI9UYvdVsc3ILnaiRd
oi7kE+pJhLpEmnQManA1Sr258MJmVjmFk/ZiJSQn/dF+Kzcgv8v7X2WHuLmClOhf
KTPltv8BADmSLxYoCCUwKQRRoNl3LOEGvKglb6zr9NfTABaGcyikokbn59A2MVkQ
2dl3Po6LJ/BusLph+xPVCU/2T2ZLhUkB/Iqz1CQXk5CxvaB9fLwj09S8pM5GucK9
g/hD7kSQdMIKB5wVzD2FwtbRpM4PjNwc4ajRMgFPC4Kg0fkY/EKjSTirQxmQJcBK
u4B8xAVby/oMdrOMNYGrpk0GZfz7w3Kuh74Gee8DwzboQ0oZdrj5noBawc7zxo+d
xQLkiXTNlVTmTI7l8p8oDy58LCQYpPmQJa7k9xACVpTENFC1Ry8wsbv0C7UE7Y9N
QYklYw6AZ3MpxLYgq3KNfyH3Z2XYS+RnmztFmvfo1ass/rrtAheDEYcjyAqfHq8/
14Y6DQ77KjijKtrWaCdU4h8vgpiPVJJj10mzmJk1wky99OTFZjcL2Gj3SMfrU8mz
lTP/+YaWW0C72rq9walTMGAtclgiZMaQTiAnqDjhEXLfJwnwzoc=
=l+2V
-----END PGP SIGNATURE-----