From patchwork Wed Apr 13 16:46:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Tyser X-Patchwork-Id: 91071 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 AC61AB6F72 for ; Thu, 14 Apr 2011 02:47:30 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9CCB6282CB; Wed, 13 Apr 2011 18:47:27 +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 lGV+J4SYzJsQ; Wed, 13 Apr 2011 18:47:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0439C282C1; Wed, 13 Apr 2011 18:47:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B3E48282C1 for ; Wed, 13 Apr 2011 18:47:22 +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 0JO2ie2h8A+H for ; Wed, 13 Apr 2011 18:47:21 +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 xes-mad.com (xes-mad.com [216.165.139.218]) by theia.denx.de (Postfix) with ESMTPS id 06DED282AA for ; Wed, 13 Apr 2011 18:47:18 +0200 (CEST) Received: from localhost.localdomain (petert [10.52.0.62]) by xes-mad.com (8.13.8/8.13.8) with ESMTP id p3DGl6J3004075; Wed, 13 Apr 2011 11:47:07 -0500 From: Peter Tyser To: u-boot@lists.denx.de Date: Wed, 13 Apr 2011 11:46:56 -0500 Message-Id: <1302713216-23363-1-git-send-email-ptyser@xes-inc.com> X-Mailer: git-send-email 1.7.0.4 X-Virus-Scanned: clamav-milter 0.96 at mail X-Virus-Status: Clean Cc: Peter Tyser , Heiko Schocher , galak@kernel.crashing.org Subject: [U-Boot] [PATCH] cfi_flash: Fix CONFIG_SYS_FLASH_AUTOPROTECT_LIST usage X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Commit 6ee1416e8184b4d9ebe6087d396a60bcecf3551c (mtd, cfi: introduce void flash_protect_default(void)) introduced a bug which resulted in boards that define CONFIG_SYS_FLASH_AUTOPROTECT_LIST not compiling with the the following errors and warning: ptyser@petert u-boot $ make -s xpedite520x Configuring for xpedite520x board... cfi_flash.c: In function 'flash_protect_default': cfi_flash.c:2118: error: 'i' undeclared (first use in this function) cfi_flash.c:2118: error: (Each undeclared identifier is reported only once cfi_flash.c:2118: error: for each function it appears in.) cfi_flash.c:2118: error: 'apl' undeclared (first use in this function) cfi_flash.c:2118: error: invalid application of 'sizeof' to incomplete type 'struct apl_s' cfi_flash.c: In function 'flash_init': cfi_flash.c:2137: warning: unused variable 'apl' Signed-off-by: Peter Tyser Reported-by: Kumar Gala Cc: Heiko Schocher --- Thanks for noticing this Kumar. drivers/mtd/cfi_flash.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 5788328..91ddcb4 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2089,6 +2089,14 @@ static void cfi_flash_set_config_reg(u32 base, u16 val) void flash_protect_default(void) { +#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST) + int i; + struct apl_s { + ulong start; + ulong size; + } apl[] = CONFIG_SYS_FLASH_AUTOPROTECT_LIST; +#endif + /* Monitor protection ON by default */ #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \ (!defined(CONFIG_MONITOR_IS_IN_RAM)) @@ -2130,12 +2138,6 @@ unsigned long flash_init (void) { unsigned long size = 0; int i; -#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST) - struct apl_s { - ulong start; - ulong size; - } apl[] = CONFIG_SYS_FLASH_AUTOPROTECT_LIST; -#endif #ifdef CONFIG_SYS_FLASH_PROTECTION /* read environment from EEPROM */