summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2020-05-25 10:58:39 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2020-05-31 10:53:37 +0200
commit7f2a17369f046399a71da196726f1234b53ff7dc (patch)
treedbff671d9bfed529387d4667d18f3b3b38d9db79 /drivers/mtd/nand
parentmtd: rawnand: nandsim: Clean error handling (diff)
downloadlinux-7f2a17369f046399a71da196726f1234b53ff7dc.tar.xz
linux-7f2a17369f046399a71da196726f1234b53ff7dc.zip
mtd: rawnand: nandsim: Keep track of the created debugfs entries
Debugfs entries should be removed in the error path, so first, keep track of them. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20200525085851.17682-6-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/nandsim.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index 5b427a50bc27..c8e9c70a6641 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -353,6 +353,9 @@ struct nandsim {
void *file_buf;
struct page *held_pages[NS_MAX_HELD_PAGES];
int held_cnt;
+
+ /* debugfs entry */
+ struct dentry *dent;
};
/*
@@ -495,7 +498,6 @@ DEFINE_SHOW_ATTRIBUTE(ns);
static int ns_debugfs_create(struct nandsim *ns)
{
struct dentry *root = nsmtd->dbg.dfs_dir;
- struct dentry *dent;
/*
* Just skip debugfs initialization when the debugfs directory is
@@ -508,9 +510,9 @@ static int ns_debugfs_create(struct nandsim *ns)
return 0;
}
- dent = debugfs_create_file("nandsim_wear_report", 0400, root, ns,
- &ns_fops);
- if (IS_ERR_OR_NULL(dent)) {
+ ns->dent = debugfs_create_file("nandsim_wear_report", 0400, root, ns,
+ &ns_fops);
+ if (IS_ERR_OR_NULL(ns->dent)) {
NS_ERR("cannot create \"nandsim_wear_report\" debugfs entry\n");
return -1;
}