summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Li <benjamin.li@qlogic.com>2007-02-26 11:06:31 -0800
committerJeff Garzik <jeff@garzik.org>2007-02-27 04:21:43 -0500
commit546faf077e14930df2ebddad9190db42f1c42f0f (patch)
tree57244f0736369b23063c080e1221d9d0e8ea6427
parent908b637fe793165b6aecdc875cdca67c4959a1ad (diff)
downloadlinux-stable-546faf077e14930df2ebddad9190db42f1c42f0f.tar.gz
linux-stable-546faf077e14930df2ebddad9190db42f1c42f0f.tar.bz2
linux-stable-546faf077e14930df2ebddad9190db42f1c42f0f.zip
qla3xxx: Return proper error codes when the 4022/4032 is being probed
The return code was not properly set when when allocating memory or mapping memory failed. Depending on the stack, the return code would sometimes return 0, which indicates everything was ok, when in fact there was an error. This would cause trouble when the module was removed. Now, we will pass back the proper return code when an error occurs during the PCI probe. Signed-off-by: Benjamin Li <benjamin.li@qlogic.com> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rwxr-xr-xdrivers/net/qla3xxx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a142cdfd947b..91d91ca0a365 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3609,8 +3609,12 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
}
ndev = alloc_etherdev(sizeof(struct ql3_adapter));
- if (!ndev)
+ if (!ndev) {
+ printk(KERN_ERR PFX "%s could not alloc etherdev\n",
+ pci_name(pdev));
+ err = -ENOMEM;
goto err_out_free_regions;
+ }
SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, &pdev->dev);
@@ -3639,6 +3643,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
if (!qdev->mem_map_registers) {
printk(KERN_ERR PFX "%s: cannot map device registers\n",
pci_name(pdev));
+ err = -EIO;
goto err_out_free_ndev;
}
@@ -3667,6 +3672,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
printk(KERN_ALERT PFX
"ql3xxx_probe: Adapter #%d, Invalid NVRAM parameters.\n",
qdev->index);
+ err = -EIO;
goto err_out_iounmap;
}