diff options
Diffstat (limited to 'drivers/mtd/maps/beech-mtd.c')
-rw-r--r-- | drivers/mtd/maps/beech-mtd.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mtd/maps/beech-mtd.c b/drivers/mtd/maps/beech-mtd.c index 5df7361d1407..a64b1a5ab316 100644 --- a/drivers/mtd/maps/beech-mtd.c +++ b/drivers/mtd/maps/beech-mtd.c | |||
@@ -72,6 +72,8 @@ static struct mtd_partition beech_partitions[2] = { | |||
72 | static int __init | 72 | static int __init |
73 | init_beech_mtd(void) | 73 | init_beech_mtd(void) |
74 | { | 74 | { |
75 | int err = 0; | ||
76 | |||
75 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); | 77 | printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR); |
76 | 78 | ||
77 | beech_mtd_map.virt = ioremap(PADDR, SIZE); | 79 | beech_mtd_map.virt = ioremap(PADDR, SIZE); |
@@ -86,12 +88,20 @@ init_beech_mtd(void) | |||
86 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); | 88 | printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8); |
87 | beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map); | 89 | beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map); |
88 | 90 | ||
89 | if (!beech_mtd) | 91 | if (!beech_mtd) { |
92 | iounmap((void *) beech_mtd_map.virt); | ||
90 | return -ENXIO; | 93 | return -ENXIO; |
94 | } | ||
91 | 95 | ||
92 | beech_mtd->owner = THIS_MODULE; | 96 | beech_mtd->owner = THIS_MODULE; |
93 | 97 | ||
94 | return add_mtd_partitions(beech_mtd, beech_partitions, 2); | 98 | err = add_mtd_partitions(beech_mtd, beech_partitions, 2); |
99 | if (err) { | ||
100 | printk("%s: add_mtd_partitions failed\n", NAME); | ||
101 | iounmap((void *) beech_mtd_map.virt); | ||
102 | } | ||
103 | |||
104 | return err; | ||
95 | } | 105 | } |
96 | 106 | ||
97 | static void __exit | 107 | static void __exit |