Commit 8149069d authored by Pan Bian's avatar Pan Bian Committed by Kalle Valo

p54: drop device reference count if fails to enable device

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: default avatarPan Bian <bianpan2016@163.com>
Acked-by: default avatarChristian Lamparter <chunkeey@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 84242b82
...@@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev, ...@@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev,
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) { if (err) {
dev_err(&pdev->dev, "Cannot enable new PCI device\n"); dev_err(&pdev->dev, "Cannot enable new PCI device\n");
return err; goto err_put;
} }
mem_addr = pci_resource_start(pdev, 0); mem_addr = pci_resource_start(pdev, 0);
...@@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev, ...@@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev,
pci_release_regions(pdev); pci_release_regions(pdev);
err_disable_dev: err_disable_dev:
pci_disable_device(pdev); pci_disable_device(pdev);
err_put:
pci_dev_put(pdev); pci_dev_put(pdev);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment