From patchwork Mon Feb 6 09:06:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 724391 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 3vH1rJ1Ytnz9ryr for ; Mon, 6 Feb 2017 20:09:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 398954AE71; Mon, 6 Feb 2017 10:09:32 +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 xMPpwp_AwxQu; Mon, 6 Feb 2017 10:09:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C2194AACE; Mon, 6 Feb 2017 10:08:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 71F1F4A99B for ; Mon, 6 Feb 2017 10:07:27 +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 pSROUorvL20q for ; Mon, 6 Feb 2017 10:07:27 +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 mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by theia.denx.de (Postfix) with ESMTPS id 6E03B4AACE for ; Mon, 6 Feb 2017 10:07:26 +0100 (CET) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id v16920eD003271; Mon, 6 Feb 2017 10:07:23 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 28d5a20nxq-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 06 Feb 2017 10:07:23 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0A3144A; Mon, 6 Feb 2017 09:07:18 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EA9112686; Mon, 6 Feb 2017 09:07:17 +0000 (GMT) Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Feb 2017 10:07:17 +0100 From: Patrick Delaunay To: Date: Mon, 6 Feb 2017 10:06:50 +0100 Message-ID: <1486372016-10654-11-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486372016-10654-1-git-send-email-patrick.delaunay@st.com> References: <1486372016-10654-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-06_03:, , signatures=0 Cc: Franck Albesa , Christophe Kerello , Patrick Delaunay , Gerald Baeza , Patrick Delaunay Subject: [U-Boot] [RFC PATCH v3 10/16] cmd: gpt: add print_gpt_info_err 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Patrick Delaunay Reviewed-by: Christophe KERELLO --- Changes in v3: None Changes in v2: None cmd/gpt.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index 7dfa44c..4d6ae8b 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -333,6 +333,16 @@ err: return errno; } +static void print_gpt_info_err(int ret) +{ + if (ret == -ENOENT) + printf("No partition list provided\n"); + if (ret == -EBADF) + printf("Missing disk guid\n"); + if ((ret == -EFAULT) || (ret == -EINVAL)) + printf("Partition list incomplete\n"); +} + static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part) { int ret; @@ -344,12 +354,7 @@ static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part) ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part, &str_disk_guid, &partitions, &part_count); if (ret) { - if (ret == -ENOENT) - printf("No partition list provided\n"); - if (ret == -EBADF) - printf("Missing disk guid\n"); - if ((ret == -EFAULT) || (ret == -EINVAL)) - printf("Partition list incomplete\n"); + print_gpt_info_err(ret); return -1; } @@ -375,16 +380,12 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part) ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part, &str_disk_guid, &partitions, &part_count); if (ret) { + print_gpt_info_err(ret); if (ret == -ENOENT) { - printf("No partition list provided - only basic check\n"); ret = gpt_verify_headers(blk_dev_desc, gpt_head, &gpt_pte); goto out; } - if (ret == -EBADF) - printf("Missing disk guid\n"); - if ((ret == -EFAULT) || (ret == -EINVAL)) - printf("Partition list incomplete\n"); return -1; }