summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorRajat Jain <rajatja@google.com>2017-02-01 14:24:08 -0800
committerMarcel Holtmann <marcel@holtmann.org>2017-02-16 17:21:59 +0100
commit10ab133b7a1a7265600d580d9e056d86aea70b53 (patch)
tree89892a30413e6211e745c61e08a617d647eb4b0f /drivers/bluetooth
parent747d3f1a8a2fc4d8447c63205421a6a67f22799b (diff)
downloadlinux-10ab133b7a1a7265600d580d9e056d86aea70b53.tar.gz
linux-10ab133b7a1a7265600d580d9e056d86aea70b53.tar.bz2
linux-10ab133b7a1a7265600d580d9e056d86aea70b53.zip
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>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btusb.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index fa4d9313442e..699b2dbaf75b 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -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)