mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-18 21:36:58 +07:00
[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>
This commit is contained in:
parent
0d2ef7d73e
commit
822e5e7269
@ -137,6 +137,7 @@ struct sa_info {
|
|||||||
struct mtd_partition *parts;
|
struct mtd_partition *parts;
|
||||||
struct mtd_info *mtd;
|
struct mtd_info *mtd;
|
||||||
int num_subdev;
|
int num_subdev;
|
||||||
|
unsigned int nr_parts;
|
||||||
struct sa_subdev_info subdev[0];
|
struct sa_subdev_info subdev[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -228,8 +229,12 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (info->mtd) {
|
if (info->mtd) {
|
||||||
del_mtd_partitions(info->mtd);
|
if (info->nr_parts == 0)
|
||||||
|
del_mtd_device(info->mtd);
|
||||||
|
#ifdef CONFIG_MTD_PARTITIONS
|
||||||
|
else
|
||||||
|
del_mtd_partitions(info->mtd);
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_MTD_CONCAT
|
#ifdef CONFIG_MTD_CONCAT
|
||||||
if (info->mtd != info->subdev[0].mtd)
|
if (info->mtd != info->subdev[0].mtd)
|
||||||
mtd_concat_destroy(info->mtd);
|
mtd_concat_destroy(info->mtd);
|
||||||
@ -396,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev)
|
|||||||
add_mtd_partitions(info->mtd, parts, nr_parts);
|
add_mtd_partitions(info->mtd, parts, nr_parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info->nr_parts = nr_parts;
|
||||||
|
|
||||||
dev_set_drvdata(dev, info);
|
dev_set_drvdata(dev, info);
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user