[PATCH v2 for-next] EDAC: use edac_debugfs_remove_recursive instead of debugfs_remove
From: Tan Xiaojun
Date: Tue Oct 13 2015 - 21:43:45 EST
debugfs_remove is used to remove a file or an empty directory from
the debugfs filesystem, but mci->debugfs is not empty.
This is not easily discovered, because debugfs_remove return nothing
when failed. It can be test like below:
1)open EDAC config and open CONFIG_EDAC_DEBUG
2)insmod a edac_mc module (like i3000_edac or others in drivers/edac/)
3)rmmod this module
4)we can also see files under /sys/kernel/debug/edac/ like
"fake_inject"
Reported-by: Yun Wu (Abel) <wuyun.wu@xxxxxxxxxx>
Signed-off-by: Tan Xiaojun <tanxiaojun@xxxxxxxxxx>
---
drivers/edac/debugfs.c | 2 +-
drivers/edac/edac_mc_sysfs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/debugfs.c b/drivers/edac/debugfs.c
index 4864703..54d2f66 100644
--- a/drivers/edac/debugfs.c
+++ b/drivers/edac/debugfs.c
@@ -98,7 +98,7 @@ int edac_create_debugfs_nodes(struct mem_ctl_info *mci)
mci->debugfs = parent;
return 0;
nomem:
- debugfs_remove(mci->debugfs);
+ edac_debugfs_remove_recursive(mci->debugfs);
return -ENOMEM;
}
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 3929391..a75acea 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -976,7 +976,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
edac_dbg(0, "\n");
#ifdef CONFIG_EDAC_DEBUG
- debugfs_remove(mci->debugfs);
+ edac_debugfs_remove_recursive(mci->debugfs);
#endif
#ifdef CONFIG_EDAC_LEGACY_SYSFS
edac_delete_csrow_objects(mci);
--
2.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/