diff options
-rw-r--r-- | drivers/mtd/maps/physmap.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 65f52d4804a2..3f13a9673e7f 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -44,12 +44,10 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
44 | return 0; | 44 | return 0; |
45 | platform_set_drvdata(dev, NULL); | 45 | platform_set_drvdata(dev, NULL); |
46 | 46 | ||
47 | if (info->cmtd == NULL) | ||
48 | return 0; | ||
49 | |||
50 | physmap_data = dev->dev.platform_data; | 47 | physmap_data = dev->dev.platform_data; |
51 | 48 | ||
52 | if (mtd_has_partitions()) { | 49 | if (info->cmtd) { |
50 | #ifdef CONFIG_MTD_PARTITIONS | ||
53 | if (info->nr_parts || physmap_data->nr_parts) { | 51 | if (info->nr_parts || physmap_data->nr_parts) { |
54 | del_mtd_partitions(info->cmtd); | 52 | del_mtd_partitions(info->cmtd); |
55 | 53 | ||
@@ -58,14 +56,14 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
58 | } else { | 56 | } else { |
59 | del_mtd_device(info->cmtd); | 57 | del_mtd_device(info->cmtd); |
60 | } | 58 | } |
61 | } else { | 59 | #else |
62 | del_mtd_device(info->cmtd); | 60 | del_mtd_device(info->cmtd); |
63 | } | 61 | #endif |
64 | |||
65 | #ifdef CONFIG_MTD_CONCAT | 62 | #ifdef CONFIG_MTD_CONCAT |
66 | if (info->cmtd != info->mtd[0]) | 63 | if (info->cmtd != info->mtd[0]) |
67 | mtd_concat_destroy(info->cmtd); | 64 | mtd_concat_destroy(info->cmtd); |
68 | #endif | 65 | #endif |
66 | } | ||
69 | 67 | ||
70 | for (i = 0; i < MAX_RESOURCES; i++) { | 68 | for (i = 0; i < MAX_RESOURCES; i++) { |
71 | if (info->mtd[i] != NULL) | 69 | if (info->mtd[i] != NULL) |
@@ -170,22 +168,22 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
170 | if (err) | 168 | if (err) |
171 | goto err_out; | 169 | goto err_out; |
172 | 170 | ||
173 | if (mtd_has_partitions()) { | 171 | #ifdef CONFIG_MTD_PARTITIONS |
174 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 172 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
175 | &info->parts, 0); | 173 | &info->parts, 0); |
176 | if (err > 0) { | 174 | if (err > 0) { |
177 | add_mtd_partitions(info->cmtd, info->parts, err); | 175 | add_mtd_partitions(info->cmtd, info->parts, err); |
178 | info->nr_parts = err; | 176 | info->nr_parts = err; |
179 | return 0; | 177 | return 0; |
180 | } | 178 | } |
181 | 179 | ||
182 | if (physmap_data->nr_parts) { | 180 | if (physmap_data->nr_parts) { |
183 | printk(KERN_NOTICE "Using physmap partition information\n"); | 181 | printk(KERN_NOTICE "Using physmap partition information\n"); |
184 | add_mtd_partitions(info->cmtd, physmap_data->parts, | 182 | add_mtd_partitions(info->cmtd, physmap_data->parts, |
185 | physmap_data->nr_parts); | 183 | physmap_data->nr_parts); |
186 | return 0; | 184 | return 0; |
187 | } | ||
188 | } | 185 | } |
186 | #endif | ||
189 | 187 | ||
190 | add_mtd_device(info->cmtd); | 188 | add_mtd_device(info->cmtd); |
191 | return 0; | 189 | return 0; |