Bluetooth: btusb: Use an error label for error paths

Use a label to remove the repetetive cleanup, for error cases.

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Rajat Jain 2017-02-01 14:24:08 -08:00 committed by Marcel Holtmann
parent 747d3f1a8a
commit 10ab133b7a

View File

@ -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)