summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2020-05-25 10:58:45 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2020-05-31 10:53:38 +0200
commitd6e4fd522461f490f49eda81b7e0fba86141ef20 (patch)
tree3b0d31bae883b8190d23ab8d97cce705d4c89bd8 /drivers/mtd
parent72e840a15c66e89583f5bf35a8d890f6c77bb2db (diff)
mtd: rawnand: nandsim: Stop using nand_release()
nand_release() basically calls mtd_device_unregister() and nand_cleanup(). Both helpers should be called after MTD device registration and NAND scan, respectively. Drop nand_release() and use the two helpers directly so that they fit the error path and the labels there. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20200525085851.17682-12-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/nandsim.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index 4bc5da3be587..127ba2081fe9 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -2400,13 +2400,15 @@ static int __init ns_init_module(void)
ret = ns_debugfs_create(ns);
if (ret)
- goto err_exit;
+ goto unregister_mtd;
return 0;
+unregister_mtd:
+ WARN_ON(mtd_device_unregister(nsmtd));
err_exit:
ns_free(ns);
- nand_release(chip);
+ nand_cleanup(chip);
error:
kfree(ns);
ns_free_lists();