diff mbox

[Xenial] UBUNTU: SAUCE: Bluetooth: decrease refcount after use

Message ID 1479134363-24112-1-git-send-email-jesse.sung@canonical.com
State New
Headers show

Commit Message

Wen-chien Jesse Sung Nov. 14, 2016, 2:39 p.m. UTC
From: Wen-chien Jesse Sung <jesse.sung@canonical.com>

BugLink: https://launchpad.net/bugs/1641569

pci_get_subsys() will increase pci device refcount if it finds a
match. Explicitly decrease refcount if a device is found.

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
---
 drivers/bluetooth/btusb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Tim Gardner Nov. 14, 2016, 2:59 p.m. UTC | #1
Yakkety and Zesty ?
Wen-chien Jesse Sung Nov. 15, 2016, 8:12 a.m. UTC | #2
2016-11-14 22:59 GMT+08:00 Tim Gardner <tim.gardner@canonical.com>:
> Yakkety and Zesty ?

We don't have this code in Y and Z so the patch is for Xenial only.

Thanks,
Jesse

>
> --
> Tim Gardner tim.gardner@canonical.com
Seth Forshee Nov. 15, 2016, 1:12 p.m. UTC | #3

Luis Henriques Nov. 15, 2016, 3:42 p.m. UTC | #4
Applied to xenial master-next branch.

Cheers,
--
Luís
diff mbox

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 842cf10..e7e5ced 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2975,9 +2975,13 @@  static int btusb_probe(struct usb_interface *intf,
 	}
 
 	if (id->driver_info & BTUSB_MARVELL) {
+		struct pci_dev *pdev;
 		hdev->set_bdaddr = btusb_set_bdaddr_marvell;
-		if (pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, 0x1028, 0x0720, NULL) ||
-			pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, 0x1028, 0x0733, NULL)) {
+		pdev = pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, 0x1028, 0x0720, NULL);
+		if (!pdev)
+			pdev = pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, 0x1028, 0x0733, NULL);
+		if (pdev) {
+			pci_dev_put(pdev);
 			hdev->post_open = btusb_edge_post_open;
 			hdev->shutdown = btusb_edge_shutdown;
 		}