From patchwork Mon Dec 7 17:01:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 553466 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 267BD140213 for ; Tue, 8 Dec 2015 04:02:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B71684B761; Mon, 7 Dec 2015 18:02:08 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ni0ajo7-le7m; Mon, 7 Dec 2015 18:02:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B8CE04B741; Mon, 7 Dec 2015 18:02:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9D58F4B741 for ; Mon, 7 Dec 2015 18:02:03 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xzuQyQw_9D3E for ; Mon, 7 Dec 2015 18:02:03 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 6FD414B739 for ; Mon, 7 Dec 2015 18:01:58 +0100 (CET) Received: from mail.nefkom.net (unknown [192.168.8.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3pDrXQ240pz3hjMG; Mon, 7 Dec 2015 18:01:58 +0100 (CET) X-Auth-Info: Z6blYUp1dRF4dUuMs5pDo/BhO+ImXyoGSs1a5824oHQ= Received: from chi.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3pDrXP5tlBzvdWS; Mon, 7 Dec 2015 18:01:57 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 7 Dec 2015 18:01:54 +0100 Message-Id: <1449507714-9599-1-git-send-email-marex@denx.de> X-Mailer: git-send-email 2.1.4 Cc: Marek Vasut , Tom Rini , Philippe De Swert Subject: [U-Boot] [PATCH] mkimage: Fix generating multi and script images again X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "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 Cc: Tom Rini Cc: Philippe De Swert Cc: Simon Glass --- 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",