summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-06-04 08:37:40 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2026-06-11 14:24:40 -0400
commit43ea69d0ef06975837e7d7270b64f4b500113837 (patch)
treed0351f6b1b04ce025df0dab424b29329f26d81a7 /drivers/bluetooth
parentcfb192390bb8e8674b78d750e31fc49a5586596d (diff)
downloadlinux-next-43ea69d0ef06975837e7d7270b64f4b500113837.tar.gz
linux-next-43ea69d0ef06975837e7d7270b64f4b500113837.zip
Bluetooth: btusb: clean up probe error handling
Clean up probe error handling by using dedicated error labels with an "err" prefix. Note that the endpoint lookup helper returns -ENXIO when endpoints are missing which is functionally equivalent to returning -ENODEV. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btusb.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 843c649f8053..08c0a99a62c5 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4119,10 +4119,8 @@ static int btusb_probe(struct usb_interface *intf,
err = usb_find_common_endpoints(intf->cur_altsetting, &data->bulk_rx_ep,
&data->bulk_tx_ep, &data->intr_ep, NULL);
- if (err) {
- kfree(data);
- return -ENODEV;
- }
+ if (err)
+ goto err_free_data;
if (id->driver_info & BTUSB_AMP) {
data->cmdreq_type = USB_TYPE_CLASS | 0x01;
@@ -4178,8 +4176,8 @@ static int btusb_probe(struct usb_interface *intf,
hdev = hci_alloc_dev_priv(priv_size);
if (!hdev) {
- kfree(data);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free_data;
}
hdev->bus = HCI_USB;
@@ -4193,7 +4191,7 @@ static int btusb_probe(struct usb_interface *intf,
GPIOD_OUT_LOW);
if (IS_ERR(reset_gpio)) {
err = PTR_ERR(reset_gpio);
- goto out_free_dev;
+ goto err_free_hdev;
} else if (reset_gpio) {
data->reset_gpio = reset_gpio;
}
@@ -4208,7 +4206,7 @@ static int btusb_probe(struct usb_interface *intf,
err = btusb_config_oob_wake(hdev);
if (err)
- goto out_free_dev;
+ goto err_put_reset;
/* Marvell devices may need a specific chip configuration */
if (id->driver_info & BTUSB_MARVELL && data->oob_wake_irq) {
@@ -4466,11 +4464,14 @@ err_disable_wakeup:
device_init_wakeup(&data->udev->dev, false);
free_irq(data->oob_wake_irq, data);
}
-out_free_dev:
+err_put_reset:
if (data->reset_gpio)
gpiod_put(data->reset_gpio);
+err_free_hdev:
hci_free_dev(hdev);
+err_free_data:
kfree(data);
+
return err;
}