mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 5/5] scripts: kwbimage: fix wrong return values on some errors
Date: Thu,  1 Oct 2020 09:43:37 +0200	[thread overview]
Message-ID: <20201001074337.23430-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20201001074337.23430-1-a.fatoum@pengutronix.de>

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-10-01  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:43 [PATCH 1/5] treewide: fix unterminated of_device_id[] reported by Coccinelle Ahmad Fatoum
2020-10-01  7:43 ` [PATCH 2/5] scripts: kwboot: allow piping full buffer size at once Ahmad Fatoum
2020-10-01  7:43 ` [PATCH 3/5] ARM: layerscape: ppa: fix wrong return values on some errors Ahmad Fatoum
2020-10-01  7:43 ` [PATCH 4/5] net: macb: " Ahmad Fatoum
2020-10-01  7:43 ` Ahmad Fatoum [this message]
2020-10-02  4:31 ` [PATCH 1/5] treewide: fix unterminated of_device_id[] reported by Coccinelle Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001074337.23430-5-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox