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
This commit is contained in:
Miquel Raynal 2020-05-25 10:58:45 +02:00
parent 72e840a15c
commit d6e4fd5224

View File

@ -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();