Skip to content

Commit

Permalink
via-rhine: Disable device in error path
Browse files Browse the repository at this point in the history
Currently, via-rhine fails to call pci_disable_device() for errors
in rhine_init_one().

Reported-by: Huqiu Liu <liuhq11@mails.tsinghua.edu.cn>
Signed-off-by: Roger Luethi <rl@hellgate.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Roger Luethi authored and David S. Miller committed Mar 19, 2014
1 parent 3e3d354 commit ae99615
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/via/via-rhine.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,15 +923,15 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) {
dev_err(&pdev->dev,
"32-bit PCI DMA addresses not supported by the card!?\n");
goto err_out;
goto err_out_pci_disable;
}

/* sanity check */
if ((pci_resource_len(pdev, 0) < io_size) ||
(pci_resource_len(pdev, 1) < io_size)) {
rc = -EIO;
dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
goto err_out;
goto err_out_pci_disable;
}

pioaddr = pci_resource_start(pdev, 0);
Expand All @@ -942,7 +942,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev = alloc_etherdev(sizeof(struct rhine_private));
if (!dev) {
rc = -ENOMEM;
goto err_out;
goto err_out_pci_disable;
}
SET_NETDEV_DEV(dev, &pdev->dev);

Expand Down Expand Up @@ -1084,6 +1084,8 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_release_regions(pdev);
err_out_free_netdev:
free_netdev(dev);
err_out_pci_disable:
pci_disable_device(pdev);
err_out:
return rc;
}
Expand Down

0 comments on commit ae99615

Please sign in to comment.