diff options
Diffstat (limited to 'drivers/mtd/maps/sa1100-flash.c')
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 50a1d434906a..c38c2c311b8e 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -137,6 +137,7 @@ struct sa_info { | |||
137 | struct mtd_partition *parts; | 137 | struct mtd_partition *parts; |
138 | struct mtd_info *mtd; | 138 | struct mtd_info *mtd; |
139 | int num_subdev; | 139 | int num_subdev; |
140 | unsigned int nr_parts; | ||
140 | struct sa_subdev_info subdev[0]; | 141 | struct sa_subdev_info subdev[0]; |
141 | }; | 142 | }; |
142 | 143 | ||
@@ -228,8 +229,12 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla | |||
228 | int i; | 229 | int i; |
229 | 230 | ||
230 | if (info->mtd) { | 231 | if (info->mtd) { |
231 | del_mtd_partitions(info->mtd); | 232 | if (info->nr_parts == 0) |
232 | 233 | del_mtd_device(info->mtd); | |
234 | #ifdef CONFIG_MTD_PARTITIONS | ||
235 | else | ||
236 | del_mtd_partitions(info->mtd); | ||
237 | #endif | ||
233 | #ifdef CONFIG_MTD_CONCAT | 238 | #ifdef CONFIG_MTD_CONCAT |
234 | if (info->mtd != info->subdev[0].mtd) | 239 | if (info->mtd != info->subdev[0].mtd) |
235 | mtd_concat_destroy(info->mtd); | 240 | mtd_concat_destroy(info->mtd); |
@@ -396,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev) | |||
396 | add_mtd_partitions(info->mtd, parts, nr_parts); | 401 | add_mtd_partitions(info->mtd, parts, nr_parts); |
397 | } | 402 | } |
398 | 403 | ||
404 | info->nr_parts = nr_parts; | ||
405 | |||
399 | dev_set_drvdata(dev, info); | 406 | dev_set_drvdata(dev, info); |
400 | err = 0; | 407 | err = 0; |
401 | 408 | ||