mirror of
https://github.com/torvalds/linux.git
synced 2026-10-14 11:54:03 +02:00
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>
This commit is contained in:
parent
494566f7a5
commit
bd9ea55b22
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user