Patchwork [U-Boot] nand: fix bug with multiple NAND devices if CONFIG_MTD_DEVICE is defined.

login
register
mail settings
Submitter Alexander Holler
Date Dec. 18, 2010, 12:16 p.m.
Message ID <1292674588-3771-1-git-send-email-holler@ahsoftware.de>
Download mbox | patch
Permalink /patch/76065/
State Accepted
Commit 7fab9dfffab3a662f6ef1967dcb90618fd28df3c
Delegated to: Scott Wood
Headers show

Comments

Alexander Holler - Dec. 18, 2010, 12:16 p.m.
The variable i has to be static, otherwise it would be always zero.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
 drivers/mtd/nand/nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Scott Wood - Jan. 4, 2011, 7:58 p.m.
On Sat, Dec 18, 2010 at 05:16:28AM -0700, Alexander Holler wrote:
> The variable i has to be static, otherwise it would be always zero.
> 
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
>  drivers/mtd/nand/nand.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied to u-boot-nand-flash.

-Scott

Patch

diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index c0e068a..d987f4c 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -43,7 +43,7 @@  static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
 			   ulong base_addr)
 {
 	int maxchips = CONFIG_SYS_NAND_MAX_CHIPS;
-	int __attribute__((unused)) i = 0;
+	static int __attribute__((unused)) i = 0;
 
 	if (maxchips < 1)
 		maxchips = 1;