From patchwork Tue Sep 17 21:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 1163605 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=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="BoQ7+DkD"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Xwjk1F2Pz9sPS for ; Wed, 18 Sep 2019 07:10:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5B5B1C21E1E; Tue, 17 Sep 2019 21:09:47 +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=T_DKIM_INVALID 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 E0EF2C21C50; Tue, 17 Sep 2019 21:09:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4EE3EC21C50; Tue, 17 Sep 2019 21:09:45 +0000 (UTC) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lists.denx.de (Postfix) with ESMTPS id 9697EC21C29 for ; Tue, 17 Sep 2019 21:09:44 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8HL9f4b122406; Tue, 17 Sep 2019 16:09:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1568754581; bh=mNagqvf5szNZ5ABrRb3pJXzGvWwR4Eeg/UCPiN1F/E8=; h=From:To:CC:Subject:Date; b=BoQ7+DkDWcp33oil0YuvlmtJ3/NQQOEbCWQxxKv0uRSnpE4Y8Pw/uvbplZtBzKqBL LeD9ZHGBsGaH2stuE4JTD0kBcTjXOSDLfs3mXoQE6MGljpw+RVRBA54vNh5sHf7gDS Az6YJXq9QUJGzxss/zUEnkWaIGCvqQ0jAwxcicuA= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8HL9fOk086677 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Sep 2019 16:09:41 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 17 Sep 2019 16:09:37 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 17 Sep 2019 16:09:38 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8HL9eE7083357; Tue, 17 Sep 2019 16:09:40 -0500 Received: from localhost ([10.250.95.88]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id x8HL9dZ11546; Tue, 17 Sep 2019 16:09:39 -0500 (CDT) From: "Andrew F. Davis" To: Tom Rini , Lokesh Vutla Date: Tue, 17 Sep 2019 17:09:33 -0400 Message-ID: <20190917210935.3666-1-afd@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors 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 has gone wrong. Add additional error messages to make the cause of the failure more obvious. Signed-off-by: Andrew F. Davis Reviewed-by: Lokesh Vutla --- tools/dumpimage.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/dumpimage.c b/tools/dumpimage.c index ee3d41dda4..d5f893daf1 100644 --- a/tools/dumpimage.c +++ b/tools/dumpimage.c @@ -35,14 +35,23 @@ static int dumpimage_extract_subimage(struct image_type_params *tparams, if (tparams->verify_header) { retval = tparams->verify_header((unsigned char *)ptr, sbuf->st_size, ¶ms); - if (retval != 0) + if (retval != 0) { + fprintf(stderr, "%s: failed to verify header of %s\n", + params.cmdname, tparams->name); return -1; + } + /* * Extract the file from the image * if verify is successful */ if (tparams->extract_subimage) { retval = tparams->extract_subimage(ptr, ¶ms); + if (retval != 0) { + fprintf(stderr, "%s: extract_subimage failed for %s\n", + params.cmdname, tparams->name); + return -3; + } } else { fprintf(stderr, "%s: extract_subimage undefined for %s\n", @@ -175,6 +184,9 @@ int main(int argc, char **argv) * image type. Returns the error code if not matched */ retval = dumpimage_extract_subimage(tparams, ptr, &sbuf); + if (retval) + fprintf(stderr, "%s: Can't extract subimage from %s\n", + params.cmdname, params.imagefile); } else { /* * Print the image information for matched image type