diff options
Diffstat (limited to 'drivers/mtd/maps/sc520cdp.c')
-rw-r--r-- | drivers/mtd/maps/sc520cdp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c index 093edd51bdc7..9b1c13aa9f20 100644 --- a/drivers/mtd/maps/sc520cdp.c +++ b/drivers/mtd/maps/sc520cdp.c @@ -227,7 +227,7 @@ static void sc520cdp_setup_par(void) static int __init init_sc520cdp(void) { - int i, devices_found = 0; + int i, j, devices_found = 0; #ifdef REPROGRAM_PAR /* reprogram PAR registers so flash appears at the desired addresses */ @@ -243,6 +243,12 @@ static int __init init_sc520cdp(void) if (!sc520cdp_map[i].virt) { printk("Failed to ioremap_nocache\n"); + for (j = 0; j < i; j++) { + if (mymtd[j]) { + map_destroy(mymtd[j]); + iounmap(sc520cdp_map[j].virt); + } + } return -EIO; } |