Re: 2.6.18-rc1-mm1

Brice Goglin
2006-07-10T01:10:52Z

Andrew Morton wrote:
> All these functions return error codes, and we're not checking them. We
> should. So there's a patch which marks all these things as __must_check,
> which causes around 1,500 new warnings.
>

Hi Andrew,

The following patch fixes such a warning in myri10ge.

thanks,
Brice

Check pci_enable_device() return value in myri10ge_resume().

Signed-off-by: Brice Goglin <brice@myri.com>
---
drivers/net/myri10ge/myri10ge.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Index: linux-mm/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-mm.orig/drivers/net/myri10ge/myri10ge.c 2006-07-09 10:36:22.000000000 -0400
+++ linux-mm/drivers/net/myri10ge/myri10ge.c 2006-07-09 11:05:23.000000000 -0400
@@ -2412,14 +2412,20 @@
return -EIO;
}
myri10ge_restore_state(mgp);
- pci_enable_device(pdev);
+
+ status = pci_enable_device(pdev);
+ if (status < 0) {
+ dev_err(&pdev->dev, "failed to enable device\n");
+ return -EIO;
+ }
+
pci_set_master(pdev);

status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED,
netdev->name, mgp);
if (status != 0) {
dev_err(&pdev->dev, "failed to allocate IRQ\n");
- goto abort_with_msi;
+ goto abort_with_enabled;
}

myri10ge_reset(mgp);
@@ -2438,7 +2444,8 @@

return 0;

-abort_with_msi:
+abort_with_enabled:
+ pci_disable_device(pdev);
return -EIO;

}