From patchwork Sat Jun 13 08:38:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 483825 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 8C8EE14027C for ; Sat, 13 Jun 2015 18:38:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 678794B664; Sat, 13 Jun 2015 10:38:47 +0200 (CEST) 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 YRlVBK4lcMqn; Sat, 13 Jun 2015 10:38:47 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DDC34B660; Sat, 13 Jun 2015 10:38:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EDF1F4B635 for ; Sat, 13 Jun 2015 10:38:36 +0200 (CEST) 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 VY45ae883PLv for ; Sat, 13 Jun 2015 10:38:36 +0200 (CEST) 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 gagarine.paulk.fr (gagarine.paulk.fr [109.190.93.129]) by theia.denx.de (Postfix) with ESMTPS id 105354B61F for ; Sat, 13 Jun 2015 10:38:32 +0200 (CEST) Received: by gagarine.paulk.fr (Postfix, from userid 65534) id 72FBC1FE69; Sat, 13 Jun 2015 10:38:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gagarine.paulk.fr 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 localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id E6FA61FE6C; Sat, 13 Jun 2015 10:38:22 +0200 (CEST) From: Paul Kocialkowski To: u-boot@lists.denx.de Date: Sat, 13 Jun 2015 10:38:17 +0200 Message-Id: <1434184697-23410-4-git-send-email-contact@paulk.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434184697-23410-1-git-send-email-contact@paulk.fr> References: <1434184697-23410-1-git-send-email-contact@paulk.fr> Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH v2 3/3] common: cmd_part: Error prints on failures 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" When a failure occurs when selecting the device or partition, the user should be notified through an error print. Signed-off-by: Paul Kocialkowski --- common/cmd_part.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/common/cmd_part.c b/common/cmd_part.c index 7212ba6..ff9bc07 100644 --- a/common/cmd_part.c +++ b/common/cmd_part.c @@ -38,8 +38,10 @@ static int do_part_uuid(int argc, char * const argv[]) return CMD_RET_USAGE; part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0); - if (part < 0) + if (part < 0) { + error("Invalid device and/or partition\n"); return 1; + } if (argc > 2) setenv(argv[2], info.uuid); @@ -82,8 +84,10 @@ static int do_part_list(int argc, char * const argv[]) } ret = get_device(argv[0], argv[1], &desc); - if (ret < 0) + if (ret < 0) { + error("Invalid device\n"); return 1; + } if (var != NULL) { int p; @@ -127,12 +131,16 @@ static int do_part_start(int argc, char * const argv[]) part = simple_strtoul(argv[2], NULL, 0); ret = get_device(argv[0], argv[1], &desc); - if (ret < 0) + if (ret < 0) { + error("Invalid device\n"); return 1; + } err = get_partition_info(desc, part, &info); - if (err) + if (err) { + error("Invalid partition number\n"); return 1; + } snprintf(buf, sizeof(buf), "0x%lx", info.start); setenv(argv[3], buf); @@ -155,12 +163,16 @@ static int do_part_size(int argc, char * const argv[]) part = simple_strtoul(argv[2], NULL, 0); ret = get_device(argv[0], argv[1], &desc); - if (ret < 0) + if (ret < 0) { + error("Invalid device\n"); return 1; + } err = get_partition_info(desc, part, &info); - if (err) + if (err) { + error("Invalid partition number\n"); return 1; + } snprintf(buf, sizeof(buf), "0x%lx", info.size); setenv(argv[3], buf);