diff options
Diffstat (limited to 'drivers/mtd/maps/cstm_mips_ixx.c')
-rw-r--r-- | drivers/mtd/maps/cstm_mips_ixx.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/mtd/maps/cstm_mips_ixx.c b/drivers/mtd/maps/cstm_mips_ixx.c index aa56defb94c8..d6bef100d69a 100644 --- a/drivers/mtd/maps/cstm_mips_ixx.c +++ b/drivers/mtd/maps/cstm_mips_ixx.c | |||
@@ -171,7 +171,14 @@ int __init init_cstm_mips_ixx(void) | |||
171 | cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr; | 171 | cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr; |
172 | cstm_mips_ixx_map[i].virt = ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size); | 172 | cstm_mips_ixx_map[i].virt = ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size); |
173 | if (!cstm_mips_ixx_map[i].virt) { | 173 | if (!cstm_mips_ixx_map[i].virt) { |
174 | int j = 0; | ||
174 | printk(KERN_WARNING "Failed to ioremap\n"); | 175 | printk(KERN_WARNING "Failed to ioremap\n"); |
176 | for (j = 0; j < i; j++) { | ||
177 | if (cstm_mips_ixx_map[j].virt) { | ||
178 | iounmap((void *)cstm_mips_ixx_map[j].virt); | ||
179 | cstm_mips_ixx_map[j].virt = 0; | ||
180 | } | ||
181 | } | ||
175 | return -EIO; | 182 | return -EIO; |
176 | } | 183 | } |
177 | cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name; | 184 | cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name; |
@@ -204,8 +211,15 @@ int __init init_cstm_mips_ixx(void) | |||
204 | cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd; | 211 | cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd; |
205 | add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions); | 212 | add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions); |
206 | } | 213 | } |
207 | else | 214 | else { |
208 | return -ENXIO; | 215 | for (i = 0; i < PHYSMAP_NUMBER; i++) { |
216 | if (cstm_mips_ixx_map[i].virt) { | ||
217 | iounmap((void *)cstm_mips_ixx_map[i].virt); | ||
218 | cstm_mips_ixx_map[i].virt = 0; | ||
219 | } | ||
220 | } | ||
221 | return -ENXIO; | ||
222 | } | ||
209 | } | 223 | } |
210 | return 0; | 224 | return 0; |
211 | } | 225 | } |