mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-29 10:52:09 +00:00
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 <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
78e20a7f4e
commit
0655b9e621
1 changed files with 7 additions and 5 deletions
12
cmd/fdt.c
12
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, &len);
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue