mtd: nandsim: remove debugfs entries in error path

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Aug 25 14:59:01 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b974696da1cfc5aa0c29ed97dc8f6c239899e64b
Commit:     b974696da1cfc5aa0c29ed97dc8f6c239899e64b
Parent:     9a51544774a57fcb94994a61860a17f9e63a8d7b
Author:     Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
AuthorDate: Wed Aug 23 09:03:04 2017 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Aug 24 20:59:43 2017 -0700

    mtd: nandsim: remove debugfs entries in error path
    
    The debugfs entries must be removed before an error is returned in the
    probe function. Otherwise another try to load the module fails and when
    the debugfs files are accessed without the module loaded, the kernel
    still tries to call a function in that module.
    
    Fixes: 5346c27c5fed ("mtd: nandsim: Introduce debugfs infrastructure")
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
    Reviewed-by: Richard Weinberger <richard at nod.at>
    Acked-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/nandsim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 03a0d05..e4211c3 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -2373,6 +2373,7 @@ static int __init ns_init_module(void)
         return 0;
 
 err_exit:
+	nandsim_debugfs_remove(nand);
 	free_nandsim(nand);
 	nand_release(nsmtd);
 	for (i = 0;i < ARRAY_SIZE(nand->partitions); ++i)



More information about the linux-mtd-cvs mailing list