Re: [patch 08/18] 3c59x: check return of pci_enable_device()
From: Steffen Klassert <hidden>
Date: 2007-08-15 20:59:15
On Wed, Aug 15, 2007 at 06:30:00PM +0200, Steffen Klassert wrote:
On Tue, Aug 14, 2007 at 10:54:32AM +0100, Mark Hindley wrote:quoted
On Tue, Aug 14, 2007 at 01:33:26AM -0400, Jeff Garzik wrote:quoted
I would strongly prefer that vortex_up return a value, since all the important callers of this function can themselves return an error back to the system. we can definitely return a meaningful return value here, if pci_enable_device() fails, and I would rather not apply a patch that fails to propagate a serious condition (pci_enable_device failure is indeed serious) when it is possible to do soOK. Any comments on this revised version? I have only ignored the return of vortex_up in vortex_error. It is not immediately clear what to do if vortex_up still fails there after a pci reset. Markdiff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 001c66d..a1dfd6b 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c@@ -705,7 +705,7 @@ static struct { static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, int chip_idx, int card_idx); -static void vortex_up(struct net_device *dev); +static int vortex_up(struct net_device *dev); static void vortex_down(struct net_device *dev, int final); static int vortex_open(struct net_device *dev); static void mdio_sync(void __iomem *ioaddr, int bits);@@ -841,8 +841,11 @@ static int vortex_resume(struct pci_dev *pdev) return -EBUSY; } if (netif_running(dev)) { - vortex_up(dev); - netif_device_attach(dev); + err = vortex_up(dev); + if (err) + return err; + else + netif_device_attach(dev); } } return 0;I think we should free the requested irq if vortex_up really fails here.
I was wrong, this will be done in vortex_close. So it is OK as it is. Steffen