disk/part.c: fix relocation fixup
authorHeiko Schocher <hs@denx.de>
Fri, 17 Sep 2010 11:10:36 +0000 (13:10 +0200)
committerWolfgang Denk <wd@denx.de>
Sun, 19 Sep 2010 17:29:52 +0000 (19:29 +0200)
Portions of this work were supported by funding from
the CE Linux Forum.

Signed-off-by: Heiko Schocher <hs@denx.de>
disk/part.c

index 1806fe6..2b63db6 100644 (file)
@@ -78,13 +78,20 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
 {
        const struct block_drvr *drvr = block_drvr;
        block_dev_desc_t* (*reloc_get_dev)(int dev);
+       char *name;
 
-       while (drvr->name) {
+       name = drvr->name;
+#ifndef CONFIG_RELOC_FIXUP_WORKS
+       name += gd->reloc_off;
+#endif
+       while (name) {
+               name = drvr->name;
                reloc_get_dev = drvr->get_dev;
 #ifndef CONFIG_RELOC_FIXUP_WORKS
+               name += gd->reloc_off;
                reloc_get_dev += gd->reloc_off;
 #endif
-               if (strncmp(ifname, drvr->name, strlen(drvr->name)) == 0)
+               if (strncmp(ifname, name, strlen(name)) == 0)
                        return reloc_get_dev(dev);
                drvr++;
        }