[PATCH 5/5] scripts: kwbimage: fix wrong return values on some errors

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Oct 1 03:43:37 EDT 2020


Coccinelle detected that bootfrom and nandeccmode are unsigned, but
check to be less than zero. Both are only used to hold the return value
of functions that either return up to 0xFF on success and a negative
error code otherwise. It's thus safe to make them signed. Do so.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 scripts/kwbimage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 26eb07fa81bc..75c9e9cda9c2 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -186,7 +186,7 @@ struct image_cfg_element {
 	} type;
 	union {
 		unsigned int version;
-		unsigned int bootfrom;
+		int bootfrom;
 		struct {
 			char *file;
 			unsigned int args[BINARY_MAX_ARGS];
@@ -197,7 +197,7 @@ struct image_cfg_element {
 		unsigned int execaddr;
 		unsigned int nandblksz;
 		unsigned int nandbadblklocation;
-		unsigned int nandeccmode;
+		int nandeccmode;
 		unsigned int nandpagesz;
 		struct ext_hdr_v0_reg regdata;
 	};
-- 
2.28.0




More information about the barebox mailing list