From: Simon Glass <sjg@chromium.org>
Date: Wed, 7 Jun 2017 16:28:41 +0000 (-0600)
Subject: fdt: Add a check to do_fdt() for coverity
X-Git-Tag: v2025.01-rc5-pxa1908~6579
X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B%20%24image.RelPermalink%20%7D%7D?a=commitdiff_plain;h=72c98ed1ab48;p=u-boot.git

fdt: Add a check to do_fdt() for coverity

We know that fdt_getprop() does not return NULL when len is > 0 but
coverity does not. Add an extra check to keep it happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163249)
Fixes: bc80295b (fdt: Add get commands to fdt)
---

diff --git a/cmd/fdt.c b/cmd/fdt.c
index e55102a18d..dc0052040a 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -380,7 +380,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				/* no property value */
 				setenv(var, "");
 				return 0;
-			} else if (len > 0) {
+			} else if (nodep && len > 0) {
 				if (subcmd[0] == 'v') {
 					int ret;