netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 8139too: use err.h macros
@ 2008-11-23 18:22 Stephen Hemminger
  2008-11-23 18:36 ` Jeff Garzik
  2008-11-24 22:47 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Hemminger @ 2008-11-23 18:22 UTC (permalink / raw)
  To: Jeff Garzik, Francois Romieu, David Miller; +Cc: netdev

Instead of using call by reference use the PTR_ERR macros to handle
return value with error case. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/8139too.c	2008-11-23 10:16:26.000000000 -0800
+++ b/drivers/net/8139too.c	2008-11-23 10:19:05.000000000 -0800
@@ -741,8 +741,7 @@ static void rtl8139_chip_reset (void __i
 }
 
 
-static int __devinit rtl8139_init_board (struct pci_dev *pdev,
-					 struct net_device **dev_out)
+static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
 {
 	void __iomem *ioaddr;
 	struct net_device *dev;
@@ -756,13 +755,11 @@ static int __devinit rtl8139_init_board 
 
 	assert (pdev != NULL);
 
-	*dev_out = NULL;
-
 	/* dev and priv zeroed in alloc_etherdev */
 	dev = alloc_etherdev (sizeof (*tp));
 	if (dev == NULL) {
 		dev_err(&pdev->dev, "Unable to alloc new net device\n");
-		return -ENOMEM;
+		return ERR_PTR(-ENOMEM);
 	}
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
@@ -906,14 +903,13 @@ match:
 
 	rtl8139_chip_reset (ioaddr);
 
-	*dev_out = dev;
-	return 0;
+	return dev;
 
 err_out:
 	__rtl8139_cleanup_dev (dev);
 	if (disable_dev_on_err)
 		pci_disable_device (pdev);
-	return rc;
+	return ERR_PTR(rc);
 }
 
 static const struct net_device_ops rtl8139_netdev_ops = {
@@ -972,9 +968,9 @@ static int __devinit rtl8139_init_one (s
 		use_io = 1;
 	}
 
-	i = rtl8139_init_board (pdev, &dev);
-	if (i < 0)
-		return i;
+	dev = rtl8139_init_board (pdev);
+	if (IS_ERR(dev))
+		return PTR_ERR(dev);
 
 	assert (dev != NULL);
 	tp = netdev_priv(dev);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-24 22:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-23 18:22 [PATCH] 8139too: use err.h macros Stephen Hemminger
2008-11-23 18:36 ` Jeff Garzik
2008-11-23 18:45   ` Stephen Hemminger
2008-11-23 21:53   ` David Miller
2008-11-23 22:31     ` Francois Romieu
2008-11-24 22:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).