mtd: partitions: remove sysfs files when deleting all master's partitions
When support for sysfs "offset" file was added it missed to update the
del_mtd_partitions function. It deletes partitions just like
mtd_del_partition does so both should also take care of removing sysfs
files.
This change moves sysfs_remove_files call to the shared function to fix
this issue.
Fixes: a62c24d755
("mtd: part: Add sysfs variable for offset of partition")
Cc: Dan Ehrenberg <dehrenberg@chromium.org>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
08263a9ae6
commit
c5ceaba740
|
@ -660,6 +660,8 @@ static int __mtd_del_partition(struct mtd_part *priv)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
sysfs_remove_files(&priv->mtd.dev.kobj, mtd_partition_attrs);
|
||||||
|
|
||||||
err = del_mtd_device(&priv->mtd);
|
err = del_mtd_device(&priv->mtd);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -700,8 +702,6 @@ int mtd_del_partition(struct mtd_info *master, int partno)
|
||||||
list_for_each_entry_safe(slave, next, &mtd_partitions, list)
|
list_for_each_entry_safe(slave, next, &mtd_partitions, list)
|
||||||
if ((slave->master == master) &&
|
if ((slave->master == master) &&
|
||||||
(slave->mtd.index == partno)) {
|
(slave->mtd.index == partno)) {
|
||||||
sysfs_remove_files(&slave->mtd.dev.kobj,
|
|
||||||
mtd_partition_attrs);
|
|
||||||
ret = __mtd_del_partition(slave);
|
ret = __mtd_del_partition(slave);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue