aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/physmap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 876dfab92847..58207b3b9411 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -29,7 +29,6 @@ struct physmap_flash_info {
29 struct map_info map[MAX_RESOURCES]; 29 struct map_info map[MAX_RESOURCES];
30#ifdef CONFIG_MTD_PARTITIONS 30#ifdef CONFIG_MTD_PARTITIONS
31 int nr_parts; 31 int nr_parts;
32 struct mtd_partition *parts;
33#endif 32#endif
34}; 33};
35 34
@@ -56,14 +55,10 @@ static int physmap_flash_remove(struct platform_device *dev)
56 for (i = 0; i < MAX_RESOURCES; i++) { 55 for (i = 0; i < MAX_RESOURCES; i++) {
57 if (info->mtd[i] != NULL) { 56 if (info->mtd[i] != NULL) {
58#ifdef CONFIG_MTD_PARTITIONS 57#ifdef CONFIG_MTD_PARTITIONS
59 if (info->nr_parts) { 58 if (info->nr_parts || physmap_data->nr_parts)
60 del_mtd_partitions(info->mtd[i]); 59 del_mtd_partitions(info->mtd[i]);
61 kfree(info->parts); 60 else
62 } else if (physmap_data->nr_parts) {
63 del_mtd_partitions(info->mtd[i]);
64 } else {
65 del_mtd_device(info->mtd[i]); 61 del_mtd_device(info->mtd[i]);
66 }
67#else 62#else
68 del_mtd_device(info->mtd[i]); 63 del_mtd_device(info->mtd[i]);
69#endif 64#endif
@@ -86,6 +81,9 @@ static int physmap_flash_probe(struct platform_device *dev)
86 int err = 0; 81 int err = 0;
87 int i; 82 int i;
88 int devices_found = 0; 83 int devices_found = 0;
84#ifdef CONFIG_MTD_PARTITIONS
85 struct mtd_partition *parts;
86#endif
89 87
90 physmap_data = dev->dev.platform_data; 88 physmap_data = dev->dev.platform_data;
91 if (physmap_data == NULL) 89 if (physmap_data == NULL)
@@ -163,9 +161,10 @@ static int physmap_flash_probe(struct platform_device *dev)
163 goto err_out; 161 goto err_out;
164 162
165#ifdef CONFIG_MTD_PARTITIONS 163#ifdef CONFIG_MTD_PARTITIONS
166 err = parse_mtd_partitions(info->cmtd, part_probe_types, &info->parts, 0); 164 err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0);
167 if (err > 0) { 165 if (err > 0) {
168 add_mtd_partitions(info->cmtd, info->parts, err); 166 add_mtd_partitions(info->cmtd, parts, err);
167 kfree(parts);
169 return 0; 168 return 0;
170 } 169 }
171 170