Commit 546faf07 authored by Benjamin Li's avatar Benjamin Li Committed by Jeff Garzik

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: default avatarBenjamin Li <benjamin.li@qlogic.com>
Signed-off-by: default avatarRon Mercer <ron.mercer@qlogic.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 908b637f
...@@ -3609,8 +3609,12 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, ...@@ -3609,8 +3609,12 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
} }
ndev = alloc_etherdev(sizeof(struct ql3_adapter)); 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; goto err_out_free_regions;
}
SET_MODULE_OWNER(ndev); SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, &pdev->dev); SET_NETDEV_DEV(ndev, &pdev->dev);
...@@ -3639,6 +3643,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, ...@@ -3639,6 +3643,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
if (!qdev->mem_map_registers) { if (!qdev->mem_map_registers) {
printk(KERN_ERR PFX "%s: cannot map device registers\n", printk(KERN_ERR PFX "%s: cannot map device registers\n",
pci_name(pdev)); pci_name(pdev));
err = -EIO;
goto err_out_free_ndev; goto err_out_free_ndev;
} }
...@@ -3667,6 +3672,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, ...@@ -3667,6 +3672,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
printk(KERN_ALERT PFX printk(KERN_ALERT PFX
"ql3xxx_probe: Adapter #%d, Invalid NVRAM parameters.\n", "ql3xxx_probe: Adapter #%d, Invalid NVRAM parameters.\n",
qdev->index); qdev->index);
err = -EIO;
goto err_out_iounmap; goto err_out_iounmap;
} }
......
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