From patchwork Sat Jan 26 02:31:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1031370 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43mg034jD4z9s7T for ; Sat, 26 Jan 2019 13:32:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 373FBC21E16; Sat, 26 Jan 2019 02:32:08 +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=SPF_HELO_PASS 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 6A204C21D65; Sat, 26 Jan 2019 02:32:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 91C00C21D8E; Sat, 26 Jan 2019 02:32:04 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lists.denx.de (Postfix) with ESMTPS id 44B04C21D65 for ; Sat, 26 Jan 2019 02:32:04 +0000 (UTC) Received: from hades.home (unknown [IPv6:2a00:23c5:58d:db00:68bb:47d:d5ca:9abd]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: martyn) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 19E2A26070C; Sat, 26 Jan 2019 02:32:03 +0000 (GMT) From: Martyn Welch To: Tom Rini Date: Sat, 26 Jan 2019 02:31:50 +0000 Message-Id: <20190126023154.19749-1-martyn.welch@collabora.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Martyn Welch , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/5] tools: dumpimage: Provide more feedback on error 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The dumpimage utility errors out in a number of places without providing sufficient feedback to allow the user to easily determine what they have done wrong. Add addtional error messages to make the cause of the failure more obvious. Signed-off-by: Martyn Welch --- tools/dumpimage.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/dumpimage.c b/tools/dumpimage.c index 7115df04c1..2847e6c0b4 100644 --- a/tools/dumpimage.c +++ b/tools/dumpimage.c @@ -80,6 +80,8 @@ int main(int argc, char **argv) case 'T': params.type = genimg_get_type_id(optarg); if (params.type < 0) { + fprintf(stderr, "%s: Invalid type\n", + params.cmdname); usage(); } break; @@ -101,8 +103,10 @@ int main(int argc, char **argv) } } - if (optind >= argc) + if (optind >= argc) { + fprintf(stderr, "%s: image file missing\n", params.cmdname); usage(); + } /* set tparams as per input type_id */ tparams = imagetool_get_type(params.type); @@ -117,8 +121,11 @@ int main(int argc, char **argv) * as per image type to be generated/listed */ if (tparams->check_params) { - if (tparams->check_params(¶ms)) + if (tparams->check_params(¶ms)) { + fprintf(stderr, "%s: Parameter check failed\n", + params.cmdname); usage(); + } } if (params.iflag)