mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Bluetooth: Use common error handling code in bt_init()
* Improve jump targets so that a bit of exception handling can be better reused at the end of this function. * Adjust five condition checks. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
This commit is contained in:
parent
ba8f359790
commit
1b259904a2
1 changed files with 17 additions and 21 deletions
|
|
@ -766,43 +766,39 @@ static int __init bt_init(void)
|
|||
return err;
|
||||
|
||||
err = sock_register(&bt_sock_family_ops);
|
||||
if (err < 0) {
|
||||
bt_sysfs_cleanup();
|
||||
return err;
|
||||
}
|
||||
if (err)
|
||||
goto cleanup_sysfs;
|
||||
|
||||
BT_INFO("HCI device and connection manager initialized");
|
||||
|
||||
err = hci_sock_init();
|
||||
if (err < 0)
|
||||
goto error;
|
||||
if (err)
|
||||
goto unregister_socket;
|
||||
|
||||
err = l2cap_init();
|
||||
if (err < 0)
|
||||
goto sock_err;
|
||||
if (err)
|
||||
goto cleanup_socket;
|
||||
|
||||
err = sco_init();
|
||||
if (err < 0) {
|
||||
l2cap_exit();
|
||||
goto sock_err;
|
||||
}
|
||||
if (err)
|
||||
goto cleanup_cap;
|
||||
|
||||
err = mgmt_init();
|
||||
if (err < 0) {
|
||||
sco_exit();
|
||||
l2cap_exit();
|
||||
goto sock_err;
|
||||
}
|
||||
if (err)
|
||||
goto cleanup_sco;
|
||||
|
||||
return 0;
|
||||
|
||||
sock_err:
|
||||
cleanup_sco:
|
||||
sco_exit();
|
||||
cleanup_cap:
|
||||
l2cap_exit();
|
||||
cleanup_socket:
|
||||
hci_sock_cleanup();
|
||||
|
||||
error:
|
||||
unregister_socket:
|
||||
sock_unregister(PF_BLUETOOTH);
|
||||
cleanup_sysfs:
|
||||
bt_sysfs_cleanup();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue