Commit 85920d43 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

8139too: use err.h macros

Instead of using call by reference use the PTR_ERR macros to handle
return value with error case. Compile tested only.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3755810c
...@@ -741,8 +741,7 @@ static void rtl8139_chip_reset (void __iomem *ioaddr) ...@@ -741,8 +741,7 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
} }
static int __devinit rtl8139_init_board (struct pci_dev *pdev, static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
struct net_device **dev_out)
{ {
void __iomem *ioaddr; void __iomem *ioaddr;
struct net_device *dev; struct net_device *dev;
...@@ -756,13 +755,11 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, ...@@ -756,13 +755,11 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
assert (pdev != NULL); assert (pdev != NULL);
*dev_out = NULL;
/* dev and priv zeroed in alloc_etherdev */ /* dev and priv zeroed in alloc_etherdev */
dev = alloc_etherdev (sizeof (*tp)); dev = alloc_etherdev (sizeof (*tp));
if (dev == NULL) { if (dev == NULL) {
dev_err(&pdev->dev, "Unable to alloc new net device\n"); dev_err(&pdev->dev, "Unable to alloc new net device\n");
return -ENOMEM; return ERR_PTR(-ENOMEM);
} }
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
...@@ -906,14 +903,13 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, ...@@ -906,14 +903,13 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
rtl8139_chip_reset (ioaddr); rtl8139_chip_reset (ioaddr);
*dev_out = dev; return dev;
return 0;
err_out: err_out:
__rtl8139_cleanup_dev (dev); __rtl8139_cleanup_dev (dev);
if (disable_dev_on_err) if (disable_dev_on_err)
pci_disable_device (pdev); pci_disable_device (pdev);
return rc; return ERR_PTR(rc);
} }
static const struct net_device_ops rtl8139_netdev_ops = { static const struct net_device_ops rtl8139_netdev_ops = {
...@@ -972,9 +968,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, ...@@ -972,9 +968,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
use_io = 1; use_io = 1;
} }
i = rtl8139_init_board (pdev, &dev); dev = rtl8139_init_board (pdev);
if (i < 0) if (IS_ERR(dev))
return i; return PTR_ERR(dev);
assert (dev != NULL); assert (dev != NULL);
tp = netdev_priv(dev); tp = netdev_priv(dev);
......
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