From patchwork Mon Mar 18 23:51:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 228847 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 1AFB22C00A7 for ; Tue, 19 Mar 2013 10:56:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D445D4A04E; Tue, 19 Mar 2013 00:55:32 +0100 (CET) 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 P1rWr0VuBGm8; Tue, 19 Mar 2013 00:55:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3ED014A092; Tue, 19 Mar 2013 00:53:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5894A4A0BE for ; Tue, 19 Mar 2013 00:53:31 +0100 (CET) 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 xAYqPSesIhRZ for ; Tue, 19 Mar 2013 00:53:29 +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 mail-qa0-f73.google.com (mail-qa0-f73.google.com [209.85.216.73]) by theia.denx.de (Postfix) with ESMTPS id 4F4F24A040 for ; Tue, 19 Mar 2013 00:53:20 +0100 (CET) Received: by mail-qa0-f73.google.com with SMTP id g10so355623qah.0 for ; Mon, 18 Mar 2013 16:53:19 -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=eGiPor4JAFDSJ3kWzBsR0j980DoItlptnUZ4GmN/8yE=; b=Pmx/hS5QFjGV23R/L0Y+pDQg9Vb1QwZpgnyquD9OvrUeAs1x1cfjt6xDREDIATKcaH eL3TrTWbPd9IGSHKGDzZZzZBYJQWUBcdF664J4OPd8GnOTuAdND3bdkePhJi8E5phJKd 986ucqW+eWpxBYMPbQXQTCDbP7ItVgqXKRWTIxdQp3rSeQ0W10EvBlO8EQ2F05XJRuSJ uQLz2mcPLbvB3r6WFRzgj4JsKqfql0vdCFkrBKG3s7q90REzNwlh/lbGz+6RK2MZqOmd kxDCWoc+Qoap3g+n/i0zVpNmbHMNaMTw+KCAbiGr67QZcnkOJ2oavtq9bgdROcBHvHdS Abvg== X-Received: by 10.58.4.137 with SMTP id k9mr15473933vek.1.1363650799347; Mon, 18 Mar 2013 16:53:19 -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 h26si2189419yhf.3.2013.03.18.16.53.19 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 18 Mar 2013 16:53:19 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 2AEB431C1D7; Mon, 18 Mar 2013 16:53:19 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 04FFF16036D; Mon, 18 Mar 2013 16:53:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 18 Mar 2013 16:51:33 -0700 Message-Id: <1363650725-30459-14-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1363650725-30459-1-git-send-email-sjg@chromium.org> References: <1363650725-30459-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQl+rkklShevEaJAqgbZuwpWe7w1gtcmHykDBK/RzPknlMzl6N2lh1/L46Ehmrfwkn89f2a0iGSM6YG6HICK2GiLbdMLhIoNY3V8L4x6MXYV2NocZXBD42Mgc8WBVblXlvxNkqbhr+VtwE7ZiQ9tMhAigKHrf04GlmD0oPuxMANFZa6+qyD/zhOicqsby6ybqSOx1iK4 Cc: Joel A Fernandes , Will Drewry , Joe Hershberger , u-boot-review@google.com, Bill Richardson , Randall Spangler , Tom Rini , Vadim Bendebury , =?UTF-8?q?Andreas=20B=C3=A4ck?= , Kees Cook Subject: [U-Boot] [PATCH v2 13/45] 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 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;