mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 05:18:45 +02:00
staging: gpib: hp_82341: Handle gpib_register_driver() errors
The function gpib_register_driver() can fail, resulting in a semi-registered module and does not return an error value if it fails. Return the error value if the first gpib_register_driver() fails and if the second gpib_register_driver() fails unregister the first gpib_register_driver() and return the error value. Add pr_err() statements indicating the fail and the error value. Signed-off-by: Nihar Chaithanya <niharchaithanya@gmail.com> Link: https://lore.kernel.org/r/20241230185633.175690-11-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4e12a09289
commit
44aaeb2c08
|
|
@ -807,8 +807,21 @@ MODULE_DEVICE_TABLE(pnp, hp_82341_pnp_table);
|
|||
|
||||
static int __init hp_82341_init_module(void)
|
||||
{
|
||||
gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE);
|
||||
gpib_register_driver(&hp_82341_interface, THIS_MODULE);
|
||||
int ret;
|
||||
|
||||
ret = gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE);
|
||||
if (ret) {
|
||||
pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = gpib_register_driver(&hp_82341_interface, THIS_MODULE);
|
||||
if (ret) {
|
||||
pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret);
|
||||
gpib_unregister_driver(&hp_82341_unaccel_interface);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user