public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mkimage: Fix generating multi and script images again
@ 2015-12-07 17:01 Marek Vasut
  2015-12-07 17:18 ` Philippe De Swert
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Marek Vasut @ 2015-12-07 17:01 UTC (permalink / raw)
  To: u-boot

Seems 6ae6e160 broke creating multi and script type images and even
building of mkimage itself. There are two problems with that patch.

First is that expression (!(x == 0) || !(x == 1)) is always true for
unsigned int x. The expression must use AND (&&) not OR (||) to be
correct.

Second is the coding which causes gcc 4.9.x and newer scream gruesome
death and murder. The expression !x == 0 && !x == 1 is ambiguous and
should instead be rewritten into (x != 0) && (x != 1) to be correct.
The parenthesis are added for clarity.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Philippe De Swert <philippedeswert@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
---
 tools/mkimage.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index ae01cb1..8f8b6df 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -311,8 +311,7 @@ NXTARG:		;
 		exit (retval);
 	}
 
-	if (!params.type == IH_TYPE_MULTI ||
-	    !params.type == IH_TYPE_SCRIPT) {
+	if ((params.type != IH_TYPE_MULTI) && (params.type != IH_TYPE_SCRIPT)) {
 		dfd = open(params.datafile, O_RDONLY | O_BINARY);
 		if (dfd < 0) {
 			fprintf(stderr, "%s: Can't open %s: %s\n",
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-07 20:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 17:01 [U-Boot] [PATCH] mkimage: Fix generating multi and script images again Marek Vasut
2015-12-07 17:18 ` Philippe De Swert
2015-12-07 17:32   ` Marek Vasut
2015-12-07 17:47 ` Wolfgang Denk
2015-12-07 18:03   ` Tom Rini
2015-12-07 18:05   ` Marek Vasut
2015-12-07 19:06 ` Tom Rini
2015-12-07 20:52   ` Philippe De Swert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox