From patchwork Tue May 7 16:11:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 242392 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 47BFE2C017F for ; Wed, 8 May 2013 02:13:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8FB024A1CB; Tue, 7 May 2013 18:13:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 TfdRPzcj329J; Tue, 7 May 2013 18:13:37 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 938D24A1DE; Tue, 7 May 2013 18:12:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 213044A1C9 for ; Tue, 7 May 2013 18:12:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 hBYpsNgk7rjo for ; Tue, 7 May 2013 18:12: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 mail-gg0-f201.google.com (mail-gg0-f201.google.com [209.85.161.201]) by theia.denx.de (Postfix) with ESMTPS id F260A4A1DA for ; Tue, 7 May 2013 18:12:22 +0200 (CEST) Received: by mail-gg0-f201.google.com with SMTP id k25so72286ggl.4 for ; Tue, 07 May 2013 09:12:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=AfpF/ynDMzXSdj4WLUpqujAcsFL59/UjxuwIUD92bxQ=; b=h/009aFa1dZRO7jQsq932QvzGyW4PpWq2wJ/L1AJ8H2ojX9fTNSloe9HR8FnDAevyZ B965Ya0ePaBVlP5pw+ayYr/hHjougn/B+bcnqv6fxG+b/PgbliFYVjPpHgx540Ijljln NY0dy1/L49cxEyz1D6oZv1r9Ppafx6ilIWji+AGolTLWWthIzMfRyN3OdVpgKrn2lo5X wCb0ctOwa97mFu2UZ+ftv1c9SEdOzixZ9lLfDQPNc+r0dgKbJxNuebEpEqLFfwTaWmwx b2z5dWRq9OZQ3sSNn/LXf2tAcsITWcZKwFS7bHdiddn/2cjHjnRugRtpacZjmkrKFSpu XgAQ== X-Received: by 10.236.80.106 with SMTP id j70mr1768521yhe.11.1367943141077; Tue, 07 May 2013 09:12:21 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id s48si3004365yhe.6.2013.05.07.09.12.21 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 07 May 2013 09:12:21 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id E786831C1EC; Tue, 7 May 2013 09:12:20 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id C900B160780; Tue, 7 May 2013 09:12:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 7 May 2013 09:11:59 -0700 Message-Id: <1367943123-16013-16-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367943123-16013-1-git-send-email-sjg@chromium.org> References: <1367943123-16013-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnyymhOrq1Rf68EVqukKZM+BWsFBVDyw+SmvfPFo2blA/aCuzZnpPnurE/ukBQB5OCR5th1LcnZmESfx8CJRqz8/gcm/ncB79F3s3PCce1qVMyg6hVv7v1NO6thpqKZo+DwFaukGq63WBGWnzJr98vJWQLb/wF9HcxXfwErCXrxgALhfFAYDev67gasmT6xW6oQVq1+ Cc: Tom Rini , Joe Hershberger , u-boot-review@google.com Subject: [U-Boot] [PATCH v4 15/19] image: Move error! string to common place X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The string " error\n" appears in each error string. Move it out to a common place. Signed-off-by: Simon Glass Reviewed-by: Marek Vasut --- Changes in v4: None Changes in v3: None Changes in v2: - Put err_msgp strings on a single line - Rebase on previous patches common/image-fit.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index c2af552..f5a777e 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -860,8 +860,7 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data, *err_msgp = NULL; if (fit_image_hash_get_algo(fit, noffset, &algo)) { - *err_msgp = " error!\nCan't get hash algo " - "property"; + *err_msgp = "Can't get hash algo property"; return -1; } printf("%s", algo); @@ -876,22 +875,20 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data, if (fit_image_hash_get_value(fit, noffset, &fit_value, &fit_value_len)) { - *err_msgp = " error!\nCan't get hash value " - "property"; + *err_msgp = "Can't get hash value property"; return -1; } if (calculate_hash(data, size, algo, value, &value_len)) { - *err_msgp = " error!\n" - "Unsupported hash algorithm"; + *err_msgp = "Unsupported hash algorithm"; return -1; } if (value_len != fit_value_len) { - *err_msgp = " error !\nBad hash value len"; + *err_msgp = "Bad hash value len"; return -1; } else if (memcmp(value, fit_value, value_len) != 0) { - *err_msgp = " error!\nBad hash value"; + *err_msgp = "Bad hash value"; return -1; } @@ -920,7 +917,7 @@ int fit_image_verify(const void *fit, int image_noffset) /* Get image data and data length */ if (fit_image_get_data(fit, image_noffset, &data, &size)) { - printf("Can't get image data/size\n"); + err_msg = "Can't get image data/size"; return 0; } @@ -945,14 +942,14 @@ int fit_image_verify(const void *fit, int image_noffset) } if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) { - err_msg = " error!\nCorrupted or truncated tree"; + err_msg = "Corrupted or truncated tree"; goto error; } return 1; error: - printf("%s for '%s' hash node in '%s' image node\n", + printf(" error!\n%s for '%s' hash node in '%s' image node\n", err_msg, fit_get_name(fit, noffset, NULL), fit_get_name(fit, image_noffset, NULL)); return 0;