diff options
author | Shahar Avidar <ikobh7@gmail.com> | 2024-04-05 10:39:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-09 17:52:13 +0200 |
commit | bd9ea55b228b689e79ebe09ab267a1181b384155 (patch) | |
tree | ab907ee413c2e8957d2e6bb41fc52ca67411a401 /drivers/staging/pi433 | |
parent | 494566f7a544ae6813bc7b41ec4e03bd62740b7c (diff) |
staging: pi433: Remove duplicated code using the "goto" error recovery scheme.
pi433_init had "unregister_chrdev" called twice.
Remove it using goto statements.
Signed-off-by: Shahar Avidar <ikobh7@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240405074000.3481217-6-ikobh7@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/pi433')
-rw-r--r-- | drivers/staging/pi433/pi433_if.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index ac4cbeb961e9..8aa6659936e8 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1401,21 +1401,21 @@ static int __init pi433_init(void) return status; status = class_register(&pi433_class); - if (status) { - unregister_chrdev(MAJOR(pi433_devt), - pi433_spi_driver.driver.name); - return status; - } + if (status) + goto unreg_chrdev; root_dir = debugfs_create_dir(KBUILD_MODNAME, NULL); status = spi_register_driver(&pi433_spi_driver); - if (status < 0) { - class_unregister(&pi433_class); - unregister_chrdev(MAJOR(pi433_devt), - pi433_spi_driver.driver.name); - } + if (status < 0) + goto unreg_class_and_remove_dbfs; + return 0; + +unreg_class_and_remove_dbfs: + class_unregister(&pi433_class); +unreg_chrdev: + unregister_chrdev(MAJOR(pi433_devt), pi433_spi_driver.driver.name); return status; } |