Commit d7db3186 authored by Bo Chen's avatar Bo Chen Committed by David S. Miller

pcnet32: add an error handling path in pcnet32_probe_pci()

Make sure to invoke pci_disable_device() when errors occur in
pcnet32_probe_pci().
Signed-off-by: default avatarBo Chen <chenbo@pdx.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdd13dd3
...@@ -1552,22 +1552,26 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1552,22 +1552,26 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!ioaddr) { if (!ioaddr) {
if (pcnet32_debug & NETIF_MSG_PROBE) if (pcnet32_debug & NETIF_MSG_PROBE)
pr_err("card has no PCI IO resources, aborting\n"); pr_err("card has no PCI IO resources, aborting\n");
return -ENODEV; err = -ENODEV;
goto err_disable_dev;
} }
err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK); err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK);
if (err) { if (err) {
if (pcnet32_debug & NETIF_MSG_PROBE) if (pcnet32_debug & NETIF_MSG_PROBE)
pr_err("architecture does not support 32bit PCI busmaster DMA\n"); pr_err("architecture does not support 32bit PCI busmaster DMA\n");
return err; goto err_disable_dev;
} }
if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) { if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
if (pcnet32_debug & NETIF_MSG_PROBE) if (pcnet32_debug & NETIF_MSG_PROBE)
pr_err("io address range already allocated\n"); pr_err("io address range already allocated\n");
return -EBUSY; err = -EBUSY;
goto err_disable_dev;
} }
err = pcnet32_probe1(ioaddr, 1, pdev); err = pcnet32_probe1(ioaddr, 1, pdev);
err_disable_dev:
if (err < 0) if (err < 0)
pci_disable_device(pdev); pci_disable_device(pdev);
......
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