]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
p54: drop device reference count if fails to enable device
authorPan Bian <bianpan2016@163.com>
Wed, 17 Apr 2019 09:41:23 +0000 (17:41 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 23 Sep 2019 20:11:53 +0000 (21:11 +0100)
commit 8149069db81853570a665f5e5648c0e526dc0e43 upstream.

The function p54p_probe takes an extra reference count of the PCI
device. However, the extra reference count is not dropped when it fails
to enable the PCI device. This patch fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/p54/p54pci.c

index d411de4090509df56f9e51a7b268296d979dc59e..7dd61b1895db4a703930c1c15da35ee7ff843418 100644 (file)
@@ -551,7 +551,7 @@ static int p54p_probe(struct pci_dev *pdev,
        err = pci_enable_device(pdev);
        if (err) {
                dev_err(&pdev->dev, "Cannot enable new PCI device\n");
-               return err;
+               goto err_put;
        }
 
        mem_addr = pci_resource_start(pdev, 0);
@@ -636,6 +636,7 @@ static int p54p_probe(struct pci_dev *pdev,
        pci_release_regions(pdev);
  err_disable_dev:
        pci_disable_device(pdev);
+err_put:
        pci_dev_put(pdev);
        return err;
 }