From patchwork Wed Jun 28 18:19:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 781825 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wyWQf4RGgz9s1h for ; Thu, 29 Jun 2017 04:24:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5E39FC21D67; Wed, 28 Jun 2017 18:23:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 35986C21C97; Wed, 28 Jun 2017 18:23:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 75B54C21C46; Wed, 28 Jun 2017 18:20:33 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id 0295AC21C38 for ; Wed, 28 Jun 2017 18:20:33 +0000 (UTC) Received: from tarshish.tkos.co.il (unknown [10.0.8.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPSA id 31FA24405FD; Wed, 28 Jun 2017 21:20:14 +0300 (IDT) From: Baruch Siach To: u-boot@lists.denx.de Date: Wed, 28 Jun 2017 21:19:43 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Wed, 28 Jun 2017 18:23:38 +0000 Cc: Baruch Siach Subject: [U-Boot] [PATCH] mkimage: fix display of image types list X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Since commit 5b9d44df2307f (mkimage: Display a better list of available image types) mkimage usage text suggest to "use -T to see a list of available image types". Unfortunately, commit 02221f29deb8 (mkimage: Convert to use getopt()) broke that feature, because getopt() fails when -T has no option argument. Make the -T option argument optional to restore the original behaviour. Cc: Simon Glass Signed-off-by: Baruch Siach --- tools/mkimage.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index d982bc5665f1..2c7801e8f836 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -144,7 +144,7 @@ static void process_args(int argc, char **argv) int opt; while ((opt = getopt(argc, argv, - "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT:vVx")) != -1) { + "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT::vVx")) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16); @@ -260,8 +260,9 @@ static void process_args(int argc, char **argv) params.skipcpy = 1; break; case 'T': - type = genimg_get_type_id(optarg); - if (type < 0) { + if (optarg) + type = genimg_get_type_id(optarg); + if (optarg == NULL || type < 0) { show_valid_options(IH_TYPE); usage("Invalid image type"); }