Skip to content

Commit 546faf0

Browse files
Benjamin LiJeff Garzik
authored andcommitted
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>
1 parent 908b637 commit 546faf0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/qla3xxx.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3609,8 +3609,12 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
36093609
}
36103610

36113611
ndev = alloc_etherdev(sizeof(struct ql3_adapter));
3612-
if (!ndev)
3612+
if (!ndev) {
3613+
printk(KERN_ERR PFX "%s could not alloc etherdev\n",
3614+
pci_name(pdev));
3615+
err = -ENOMEM;
36133616
goto err_out_free_regions;
3617+
}
36143618

36153619
SET_MODULE_OWNER(ndev);
36163620
SET_NETDEV_DEV(ndev, &pdev->dev);
@@ -3639,6 +3643,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
36393643
if (!qdev->mem_map_registers) {
36403644
printk(KERN_ERR PFX "%s: cannot map device registers\n",
36413645
pci_name(pdev));
3646+
err = -EIO;
36423647
goto err_out_free_ndev;
36433648
}
36443649

@@ -3667,6 +3672,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
36673672
printk(KERN_ALERT PFX
36683673
"ql3xxx_probe: Adapter #%d, Invalid NVRAM parameters.\n",
36693674
qdev->index);
3675+
err = -EIO;
36703676
goto err_out_iounmap;
36713677
}
36723678

0 commit comments

Comments
 (0)