diff options
Diffstat (limited to 'drivers/mtd/maps/sbc8240.c')
-rw-r--r-- | drivers/mtd/maps/sbc8240.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c index 7d0fcf8f4f33..b8c1331b7a04 100644 --- a/drivers/mtd/maps/sbc8240.c +++ b/drivers/mtd/maps/sbc8240.c | |||
@@ -156,7 +156,7 @@ int __init init_sbc8240_mtd (void) | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | int devicesfound = 0; | 158 | int devicesfound = 0; |
159 | int i; | 159 | int i,j; |
160 | 160 | ||
161 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | 161 | for (i = 0; i < NUM_FLASH_BANKS; i++) { |
162 | printk (KERN_NOTICE MSG_PREFIX | 162 | printk (KERN_NOTICE MSG_PREFIX |
@@ -166,6 +166,10 @@ int __init init_sbc8240_mtd (void) | |||
166 | (unsigned long) ioremap (pt[i].addr, pt[i].size); | 166 | (unsigned long) ioremap (pt[i].addr, pt[i].size); |
167 | if (!sbc8240_map[i].map_priv_1) { | 167 | if (!sbc8240_map[i].map_priv_1) { |
168 | printk (MSG_PREFIX "failed to ioremap\n"); | 168 | printk (MSG_PREFIX "failed to ioremap\n"); |
169 | for (j = 0; j < i; j++) { | ||
170 | iounmap((void *) sbc8240_map[j].map_priv_1); | ||
171 | sbc8240_map[j].map_priv_1 = 0; | ||
172 | } | ||
169 | return -EIO; | 173 | return -EIO; |
170 | } | 174 | } |
171 | simple_map_init(&sbc8240_mtd[i]); | 175 | simple_map_init(&sbc8240_mtd[i]); |
@@ -175,6 +179,11 @@ int __init init_sbc8240_mtd (void) | |||
175 | if (sbc8240_mtd[i]) { | 179 | if (sbc8240_mtd[i]) { |
176 | sbc8240_mtd[i]->module = THIS_MODULE; | 180 | sbc8240_mtd[i]->module = THIS_MODULE; |
177 | devicesfound++; | 181 | devicesfound++; |
182 | } else { | ||
183 | if (sbc8240_map[i].map_priv_1) { | ||
184 | iounmap((void *) sbc8240_map[i].map_priv_1); | ||
185 | sbc8240_map[i].map_priv_1 = 0; | ||
186 | } | ||
178 | } | 187 | } |
179 | } | 188 | } |
180 | 189 | ||