Skip to content

Commit

Permalink
mtd: rawnand: nandsim: Stop using nand_release()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
  • Loading branch information
miquelraynal committed May 31, 2020
1 parent 72e840a commit d6e4fd5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/mtd/nand/raw/nandsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d6e4fd5

Please sign in to comment.