gpio: mockup: fix resource leak in error path
commit1b02d9e770
upstream. If the module init function fails after creating the debugs directory, it's never removed. Add proper cleanup calls to avoid this resource leak. Fixes:9202ba2397
("gpio: mockup: implement event injecting over debugfs") Cc: <stable@vger.kernel.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b079337f69
commit
035f59ad4b
|
@ -497,6 +497,7 @@ static int __init gpio_mockup_init(void)
|
||||||
err = platform_driver_register(&gpio_mockup_driver);
|
err = platform_driver_register(&gpio_mockup_driver);
|
||||||
if (err) {
|
if (err) {
|
||||||
gpio_mockup_err("error registering platform driver\n");
|
gpio_mockup_err("error registering platform driver\n");
|
||||||
|
debugfs_remove_recursive(gpio_mockup_dbg_dir);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,6 +528,7 @@ static int __init gpio_mockup_init(void)
|
||||||
gpio_mockup_err("error registering device");
|
gpio_mockup_err("error registering device");
|
||||||
platform_driver_unregister(&gpio_mockup_driver);
|
platform_driver_unregister(&gpio_mockup_driver);
|
||||||
gpio_mockup_unregister_pdevs();
|
gpio_mockup_unregister_pdevs();
|
||||||
|
debugfs_remove_recursive(gpio_mockup_dbg_dir);
|
||||||
return PTR_ERR(pdev);
|
return PTR_ERR(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue