Re: [PATCH v2 02/32] cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
On 3/8/23 23:17, Simon Glass wrote: Hi Marek, On Wed, 1 Mar 2023 at 20:09, Marek Vasut wrote: It is perfectly valid to request an address or size of FDT property without value, the only special case if requesting of the value of FDT property without value. Invert the test such, that properties without value still set the variable from 'fdt get addr/size' to address of the property or size of the property, where the later is 0. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- Cc: Heinrich Schuchardt Cc: Simon Glass Cc: Tom Rini --- V2: Add RB from Simon BTW 'patman status' can collect review tags and add them to your commits automatically. Regards, Simon Applied to u-boot-dm/next, thanks! Shouldn't this be applied to current release, since those are fixes ? (or at least the first 10 or so are, the rest are tests for those fixes obv)
Re: [PATCH v2 02/32] cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
Hi Marek, On Wed, 1 Mar 2023 at 20:09, Marek Vasut wrote: > > It is perfectly valid to request an address or size of FDT property > without value, the only special case if requesting of the value of > FDT property without value. Invert the test such, that properties > without value still set the variable from 'fdt get addr/size' to > address of the property or size of the property, where the later > is 0. > > Signed-off-by: Marek Vasut > Reviewed-by: Simon Glass > --- > Cc: Heinrich Schuchardt > Cc: Simon Glass > Cc: Tom Rini > --- > V2: Add RB from Simon BTW 'patman status' can collect review tags and add them to your commits automatically. Regards, Simon Applied to u-boot-dm/next, thanks!
Re: [PATCH v2 02/32] cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
Hi Marek, On Wed, 1 Mar 2023 at 20:09, Marek Vasut wrote: > > It is perfectly valid to request an address or size of FDT property > without value, the only special case if requesting of the value of > FDT property without value. Invert the test such, that properties > without value still set the variable from 'fdt get addr/size' to > address of the property or size of the property, where the later > is 0. > > Signed-off-by: Marek Vasut > Reviewed-by: Simon Glass > --- > Cc: Heinrich Schuchardt > Cc: Simon Glass > Cc: Tom Rini > --- > V2: Add RB from Simon BTW 'patman status' can collect review tags and add them to your commits automatically. Regards, Simon
[PATCH v2 02/32] cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
It is perfectly valid to request an address or size of FDT property without value, the only special case if requesting of the value of FDT property without value. Invert the test such, that properties without value still set the variable from 'fdt get addr/size' to address of the property or size of the property, where the later is 0. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- Cc: Heinrich Schuchardt Cc: Simon Glass Cc: Tom Rini --- V2: Add RB from Simon --- cmd/fdt.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/fdt.c b/cmd/fdt.c index bf2415661e2..56b3585c3ac 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -446,15 +446,17 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else { nodep = fdt_getprop( working_fdt, nodeoffset, prop, ); - if (len == 0) { - /* no property value */ - env_set(var, ""); - return 0; - } else if (nodep && len > 0) { + if (nodep && len >= 0) { if (subcmd[0] == 'v') { int index = 0; int ret; + if (len == 0) { + /* no property value */ + env_set(var, ""); + return 0; + } + if (argc == 7) index = simple_strtoul(argv[6], NULL, 10); -- 2.39.2