NAND: Fixed invalid pointers to static relocated chip names
authorValeriy Glushkov <gvv@lstec.com>
Mon, 19 Jan 2009 14:32:59 +0000 (16:32 +0200)
committerScott Wood <scottwood@freescale.com>
Fri, 6 Feb 2009 23:28:31 +0000 (17:28 -0600)
Dear Wolfgang,

You are right, the patch was ugly.
The new one seems to be better.

Signed-off-by: Valeriy Glushkov <gvv@lstec.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
drivers/mtd/nand/nand.c

index cf9261786d8e497472684d379b01cb00c7afb12c..70b605f9d2816365bad1be4079268db6ef5d2e8e 100644 (file)
@@ -28,6 +28,8 @@
 #define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 int nand_curr_device = -1;
 nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
 
@@ -46,6 +48,8 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
                if (nand_scan(mtd, 1) == 0) {
                        if (!mtd->name)
                                mtd->name = (char *)default_nand_name;
+                       else
+                               mtd->name += gd->reloc_off;
                } else
                        mtd->name = NULL;
        } else {