mkimage: Fix warning from fix for generating multi and script images again
authorMarek Vasut <marex@denx.de>
Mon, 7 Dec 2015 17:01:54 +0000 (18:01 +0100)
committerVagrant Cascadian <vagrant@debian.org>
Tue, 8 Dec 2015 16:59:47 +0000 (16:59 +0000)
commitd0fe218c55bdfacb16012b00ef9d98ebd5f027a9
tree185f25e665e338378a4107100e783804cf6dd5dc
parent184be0ddb40188394a9118753e862a2a2143a947
mkimage: Fix warning from fix for generating multi and script images again

Seems 6ae6e160 broke creating images in certain cases, there
are two problems with that patch.

First is that the expression "!x == 4 || !x == 6" is ambiguous.  The
intention here was "!(x == 4) || !(x == 6)" based on reading further in
the file, where this was borrowed from.  This however is interpreted by
gcc as "(!x) == 4 || (!x) == 6" and always false.  gcc-5.x will warn
about this case.

The second problem is that we do not want to test for the case of "(NOT x
is 4) OR (NOT x is 6)" but instead "(x is not equal to 4) AND (x is not
equal to 6)".  This is because in those two cases we already execute the
code question in another part of the file.  Rewrite the expression and
add parenthesis 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>
[trini: Re-word Marek's explanation]

Gbp-Pq: Topic upstream/mkimage-fix-multi-script
Gbp-Pq: Name 0002-mkimage-Fix-warning-from-fix-for-generating-multi-an.patch
tools/mkimage.c