mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
mtd: core: don't remove debugfs directory if device is in use
[ Upstream commit c13de2386c78e890d4ae6f01a85eefd0b293fb08 ]
Previously, if del_mtd_device() failed with -EBUSY due to a non-zero
usecount, a subsequent call to attempt the deletion again would try to
remove a debugfs directory that had already been removed and panic.
With this change the second call can instead proceed safely.
Fixes: e8e3edb95c ("mtd: create per-device and module-scope debugfs entries")
Signed-off-by: Zev Weiss <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
59929f9a57
commit
04317e7474
1 changed files with 2 additions and 2 deletions
|
|
@ -727,8 +727,6 @@ int del_mtd_device(struct mtd_info *mtd)
|
|||
|
||||
mutex_lock(&mtd_table_mutex);
|
||||
|
||||
debugfs_remove_recursive(mtd->dbg.dfs_dir);
|
||||
|
||||
if (idr_find(&mtd_idr, mtd->index) != mtd) {
|
||||
ret = -ENODEV;
|
||||
goto out_error;
|
||||
|
|
@ -744,6 +742,8 @@ int del_mtd_device(struct mtd_info *mtd)
|
|||
mtd->index, mtd->name, mtd->usecount);
|
||||
ret = -EBUSY;
|
||||
} else {
|
||||
debugfs_remove_recursive(mtd->dbg.dfs_dir);
|
||||
|
||||
/* Try to remove the NVMEM provider */
|
||||
if (mtd->nvmem)
|
||||
nvmem_unregister(mtd->nvmem);
|
||||
|
|
|
|||
Loading…
Reference in a new issue