From patchwork Mon Apr 22 12:51:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 238520 X-Patchwork-Delegate: sjg@chromium.org 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 028F72C00C7 for ; Mon, 22 Apr 2013 22:53:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A9DCC4A203; Mon, 22 Apr 2013 14:53:45 +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 p5hGTSOExBm4; Mon, 22 Apr 2013 14:53:45 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 32DC44A200; Mon, 22 Apr 2013 14:52:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24F654A1A3 for ; Mon, 22 Apr 2013 14:52:38 +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 FS2N8RRzG9Dy for ; Mon, 22 Apr 2013 14:52:35 +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-gh0-f201.google.com (mail-gh0-f201.google.com [209.85.160.201]) by theia.denx.de (Postfix) with ESMTPS id 3411F4A1C7 for ; Mon, 22 Apr 2013 14:52:32 +0200 (CEST) Received: by mail-gh0-f201.google.com with SMTP id r13so565485ghr.4 for ; Mon, 22 Apr 2013 05:52:31 -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=KzyAdBxjFw86hmdg/nPbqOcRny4oL9ubrvOq3nPRCbw=; b=minYmDhAHn4L9+H9PBrj8fEFlAO/KX404xCaXe6VCXw+iekbz+uyTB+MvzQMevlLPC q7mwxqnd7KxJov5t96uvtz3PqG20LyINLX/yFwU2Id0zbNadAFZfzR1NkB+5ZZ2lNt2f e0zKGJBgWpa0b72/muog08nKV2ikazrp4LdPdaOvKFjYs9a55XzrX4bMXlGVgykgNF3T c95bg7lcLEJaePNmEX3j7VifTsehdaB4YKtyDJKe0SL2vuQr1KTbRb4QQM06jKHDtyAZ eryDL3mPGXdpBRoxlsvtW8cRraL2vN/8rLJgA1SCweyV8gAVaDn1Dk+pnfbWRPwqu6ca rr+w== X-Received: by 10.236.181.234 with SMTP id l70mr12785092yhm.53.1366635151785; Mon, 22 Apr 2013 05:52:31 -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 p70si4783780yhd.5.2013.04.22.05.52.31 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 22 Apr 2013 05:52:31 -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 9EB9931C19E; Mon, 22 Apr 2013 05:52:31 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 7DAD21609CA; Mon, 22 Apr 2013 05:52:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 22 Apr 2013 05:51:43 -0700 Message-Id: <1366635107-21588-16-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1366635107-21588-1-git-send-email-sjg@chromium.org> References: <1366635107-21588-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQncRF/mw6lAEeRD4QbHuFzikMjUZJ+f3BJFf8INVWU1tPlaG1/KC9RU/IhH6rYwnW8+xNbXAUHidwuaQgVhMaMh+LJVizPPLM+3aoMf/e1GV2HtaZZ+MfzJsvR0YqArQTKS5Dsv7OkuzkR18xvhaWdM6wRpCsLVUdYR/nDfH4m8bPgTjkMqwuUoYfNPlM6TH3Gvuki+ Cc: Tom Rini , Joe Hershberger , u-boot-review@google.com Subject: [U-Boot] [PATCH v3 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 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 fa21f18..97f8521 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; } @@ -921,7 +918,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; } @@ -947,14 +944,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;