[PATCH v3 6/7] staging: pi433: Add debugfs_remove in case of driver register fails.

Shahar Avidar
2024-04-05T07:40:19Z

debugfs resources were never cleaned in case of failure to register driver.

Fixes: 4ef027d5a367 ("staging: pi433: add debugfs interface")
Reported-by Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Shahar Avidar <ikobh7@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index b01ee145ff3c..77e37a5bd1a2 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1415,6 +1415,7 @@ static int __init pi433_init(void)
return 0;

unreg_class_and_remove_dbfs:
+ debugfs_remove(root_dir);
class_unregister(&pi433_class);
unreg_chrdev:
unregister_chrdev(MAJOR(pi433_devt), pi433_spi_driver.driver.name);
--
2.34.1