From patchwork Wed Nov 21 12:59:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 200771 X-Patchwork-Delegate: scottwood@freescale.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 B88F82C0098 for ; Thu, 22 Nov 2012 01:04:46 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 153924A329; Wed, 21 Nov 2012 15:04:39 +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 IQxVXLngXpEK; Wed, 21 Nov 2012 15:04:38 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C98E44A32C; Wed, 21 Nov 2012 15:04:21 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DAB504A02F for ; Wed, 21 Nov 2012 13:59:34 +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 0hnZ1oYoyfr0 for ; Wed, 21 Nov 2012 13:59:33 +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 zimbra.vipri.net (zimbra.vipri.net [89.207.250.15]) by theia.denx.de (Postfix) with ESMTP id 4407F4A02E for ; Wed, 21 Nov 2012 13:59:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.vipri.net (Postfix) with ESMTP id 32B6C21C006 for ; Wed, 21 Nov 2012 13:57:34 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.vipri.net Received: from zimbra.vipri.net ([127.0.0.1]) by localhost (zimbra.vipri.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G-ClywxEE0Ts for ; Wed, 21 Nov 2012 13:57:34 +0100 (CET) Received: from phil.computerman.de (host-089-207-255-234.vipri.net [89.207.255.234]) by zimbra.vipri.net (Postfix) with ESMTPSA id CFA0521C004 for ; Wed, 21 Nov 2012 13:57:33 +0100 (CET) From: Phil Sutter To: u-boot@lists.denx.de Date: Wed, 21 Nov 2012 13:59:20 +0100 Message-Id: <1353502761-12640-3-git-send-email-phil.sutter@viprinet.com> X-Mailer: git-send-email 1.7.12.3 In-Reply-To: <1353502761-12640-1-git-send-email-phil.sutter@viprinet.com> References: <1353502761-12640-1-git-send-email-phil.sutter@viprinet.com> X-Mailman-Approved-At: Wed, 21 Nov 2012 15:04:17 +0100 Subject: [U-Boot] [PATCH 3/4] env_nand.c: do warn only if really no valid environment could be loaded 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 warning is misleading, since there is no equivalent success note when reading the other copy succeeds. Signed-off-by: Phil Sutter --- common/env_nand.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/env_nand.c b/common/env_nand.c index 895532b..58ba558 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -315,6 +315,7 @@ int get_nand_env_oob(nand_info_t *nand, unsigned long *result) void env_relocate_spec(void) { #if !defined(ENV_IS_EMBEDDED) + int read1_fail = 0, read2_fail = 0; int crc1_ok = 0, crc2_ok = 0; env_t *ep, *tmp_env1, *tmp_env2; @@ -326,11 +327,11 @@ void env_relocate_spec(void) goto done; } - if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1)) - puts("No Valid Environment Area found\n"); + read1_fail = readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1); + read2_fail = readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2); - if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2)) - puts("No Valid Redundant Environment Area found\n"); + if (read1_fail && read2_fail) + puts("No Valid Environment Area found\n"); crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc; crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;