Commit 10ab133b authored by Rajat Jain's avatar Rajat Jain Committed by Marcel Holtmann

Bluetooth: btusb: Use an error label for error paths

Use a label to remove the repetetive cleanup, for error cases.
Signed-off-by: default avatarRajat Jain <rajatja@google.com>
Reviewed-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 747d3f1a
......@@ -2995,18 +2995,15 @@ static int btusb_probe(struct usb_interface *intf,
err = usb_set_interface(data->udev, 0, 0);
if (err < 0) {
BT_ERR("failed to set interface 0, alt 0 %d", err);
hci_free_dev(hdev);
return err;
goto out_free_dev;
}
}
if (data->isoc) {
err = usb_driver_claim_interface(&btusb_driver,
data->isoc, data);
if (err < 0) {
hci_free_dev(hdev);
return err;
}
if (err < 0)
goto out_free_dev;
}
#ifdef CONFIG_BT_HCIBTUSB_BCM
......@@ -3020,14 +3017,16 @@ static int btusb_probe(struct usb_interface *intf,
#endif
err = hci_register_dev(hdev);
if (err < 0) {
hci_free_dev(hdev);
return err;
}
if (err < 0)
goto out_free_dev;
usb_set_intfdata(intf, data);
return 0;
out_free_dev:
hci_free_dev(hdev);
return err;
}
static void btusb_disconnect(struct usb_interface *intf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment