Skip to content

Commit

Permalink
Bluetooth: btusb: fix PM leak in error case of setup
Browse files Browse the repository at this point in the history
If setup() fails a reference for runtime PM has already
been taken. Proper use of the error handling in btusb_open()is needed.
You cannot just return.

Fixes: ace3198 ("Bluetooth: btusb: Add setup callback for chip init on USB")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Oliver Neukum authored and Marcel Holtmann committed Nov 15, 2019
1 parent 90bc72b commit 3d44a6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ static int btusb_open(struct hci_dev *hdev)
if (data->setup_on_usb) {
err = data->setup_on_usb(hdev);
if (err < 0)
return err;
goto setup_fail;
}

data->intf->needs_remote_wakeup = 1;
Expand Down Expand Up @@ -1239,6 +1239,7 @@ static int btusb_open(struct hci_dev *hdev)

failed:
clear_bit(BTUSB_INTR_RUNNING, &data->flags);
setup_fail:
usb_autopm_put_interface(data->intf);
return err;
}
Expand Down

0 comments on commit 3d44a6f

Please sign in to comment.