Skip to content

Commit

Permalink
ne2k-pci: Add pci_disable_device in error handling
Browse files Browse the repository at this point in the history
For linux-3.18.0
The driver lacks pci_disable_device in error handling code of
ne2k_pci_init_one, so the device enabled by pci_enable_device is not
disabled when errors occur.
This patch fixes this problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jia-Ju Bai authored and David S. Miller committed Dec 27, 2014
1 parent a22a9e4 commit eb69c5b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/8390/ne2k-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,

if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_IO) == 0)) {
dev_err(&pdev->dev, "no I/O resource at PCI BAR #0\n");
return -ENODEV;
goto err_out;
}

if (request_region (ioaddr, NE_IO_EXTENT, DRV_NAME) == NULL) {
dev_err(&pdev->dev, "I/O resource 0x%x @ 0x%lx busy\n",
NE_IO_EXTENT, ioaddr);
return -EBUSY;
goto err_out;
}

reg0 = inb(ioaddr);
Expand Down Expand Up @@ -392,6 +392,8 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,
free_netdev (dev);
err_out_free_res:
release_region (ioaddr, NE_IO_EXTENT);
err_out:
pci_disable_device(pdev);
return -ENODEV;
}

Expand Down

0 comments on commit eb69c5b

Please sign in to comment.