Skip to content

Commit

Permalink
p54: drop device reference count if fails to enable device
Browse files Browse the repository at this point in the history
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.

Cc: [email protected]
Signed-off-by: Pan Bian <[email protected]>
Acked-by: Christian Lamparter <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
SinkFinder authored and gregkh committed May 25, 2019
1 parent 09abe5a commit 224354c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/intersil/p54/p54pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 224354c

Please sign in to comment.