diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-29 11:03:24 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-29 11:03:24 -0400 |
commit | 822e5e72697ce06e4425c17d161b0482c7d9b6d4 (patch) | |
tree | 0668a09f5da7722ea972d203c931a39dea8b6a5f /drivers/mtd/maps | |
parent | 0d2ef7d73e0b5173af3940139569bebd2375f441 (diff) |
[ARM] Fix MTD device/partition destruction
We should not delete MTD partitions when we registered a MTD
device.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mtd/maps')
-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 | ||