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)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 25 Apr 2019 16:56:56 +0000 (19:56 +0300)
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.

Cc: stable@vger.kernel.org
Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/intersil/p54/p54pci.c

index 27a49068d32d0a71e90b69c3a3b0289be956ff94..57ad56435dda53ed852f9a4935430fa9cdea7e52 100644 (file)
@@ -554,7 +554,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);
@@ -639,6 +639,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;
 }