From patchwork Sat Jan 5 01:51:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 209600 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 474392C008D for ; Sat, 5 Jan 2013 12:57:55 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EAD024A0A1; Sat, 5 Jan 2013 02:57:48 +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 VRt+xnIMwiHi; Sat, 5 Jan 2013 02:57:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9EFDC4A0AD; Sat, 5 Jan 2013 02:56:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E92B44A096 for ; Sat, 5 Jan 2013 02:56:40 +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 Gmz2LY7uIEuw for ; Sat, 5 Jan 2013 02:56:40 +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-fa0-f74.google.com (mail-fa0-f74.google.com [209.85.161.74]) by theia.denx.de (Postfix) with ESMTPS id 1DE5C4A036 for ; Sat, 5 Jan 2013 02:56:38 +0100 (CET) Received: by mail-fa0-f74.google.com with SMTP id t1so1064786fae.1 for ; Fri, 04 Jan 2013 17:56:37 -0800 (PST) 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=bZpihFOTb+yPYYl4aVhkKX7SGFoZD5jEt0C262qEwt0=; b=kmxfA5Rx0jltfNY5MAXKAJ16LSQHRW6IaF9Mgm9vuY9kXt8luHPQio4NImveCAc9ct tHCgC72AKOujhMDUkglgVFsqWxMfn5WuYCyG6z/JkE6dJeGVNAepZtNbtlb21sdFGbQi gWy/E245uXJAFY7vdRFOejIbgOoaJoxeonfmgtLcw4gLeOQ2w242qeBjjcjzutwV00t+ YiXLbaa6yoEz0/e5xP3ZTZxtgq+iROF7nG3TGRVJ23gkxo0ssMqKXGOGVRUB2Bo6mnJx QHKTzQjoxeyRsMNi5B3dq16bG1mW5ee651c5Pf1kPx/Wi+k5SWdzy76moCbOJxAce/he JcvA== X-Received: by 10.14.205.194 with SMTP id j42mr69203321eeo.2.1357350997592; Fri, 04 Jan 2013 17:56:37 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z44si19166956een.0.2013.01.04.17.56.37 (version=TLSv1/SSLv3 cipher=AES128-SHA); Fri, 04 Jan 2013 17:56:37 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 352B7200063; Fri, 4 Jan 2013 17:56:37 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 94594160F56; Fri, 4 Jan 2013 17:56:36 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Fri, 4 Jan 2013 17:51:42 -0800 Message-Id: <1357350734-13737-14-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1357350734-13737-1-git-send-email-sjg@chromium.org> References: <1357350734-13737-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQltOP0hi6L6R3KMXPOtJU29QWV1l3MOdiUtImOfpenGkw6T91JVev6qFDJDC83yao8wlkEmk/Z8TNHCFedUN20ZKcRE4iB6lV6l1UXNJ8Znv2t72ps1bZ1zeh7HKin2U5jMgmO+1SneLvkoBV0jFp7X0kN6UdY6AyOHFZ6Ts0OrX92UC02+ZXKqU2swVAY7l0/hSCu4 Cc: Joel A Fernandes , Joe Hershberger , Tom Rini , Vadim Bendebury , =?UTF-8?q?Andreas=20B=C3=A4ck?= Subject: [U-Boot] [RFC PATCH 13/44] 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 --- common/image-fit.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index 4a78a5c..19942e2 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -867,7 +867,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 " + *err_msgp = "Can't get hash algo " "property"; return -1; } @@ -883,23 +883,23 @@ 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 " + *err_msgp = "Can't get hash value " "property"; return -1; } if (calculate_hash(data, size, algo, value, &value_len)) { - *err_msgp = " error!\n" + *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; } @@ -929,7 +929,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; } @@ -955,14 +955,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;