Skip to content

Commit bb14a1a

Browse files
Casey Leedomdavem330
authored andcommitted
cxgb4vf: Check driver parameters in the right place ...
Check module parameter validity in the module initialization routine instead of the PCI Device Probe routine. Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 98200ec commit bb14a1a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/net/cxgb4vf/cxgb4vf_main.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,17 +2488,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
24882488
struct port_info *pi;
24892489
struct net_device *netdev;
24902490

2491-
/*
2492-
* Vet our module parameters.
2493-
*/
2494-
if (msi != MSI_MSIX && msi != MSI_MSI) {
2495-
dev_err(&pdev->dev, "bad module parameter msi=%d; must be %d"
2496-
" (MSI-X or MSI) or %d (MSI)\n", msi, MSI_MSIX,
2497-
MSI_MSI);
2498-
err = -EINVAL;
2499-
goto err_out;
2500-
}
2501-
25022491
/*
25032492
* Print our driver banner the first time we're called to initialize a
25042493
* device.
@@ -2802,7 +2791,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
28022791
err_disable_device:
28032792
pci_disable_device(pdev);
28042793

2805-
err_out:
28062794
return err;
28072795
}
28082796

@@ -2915,6 +2903,17 @@ static int __init cxgb4vf_module_init(void)
29152903
{
29162904
int ret;
29172905

2906+
/*
2907+
* Vet our module parameters.
2908+
*/
2909+
if (msi != MSI_MSIX && msi != MSI_MSI) {
2910+
printk(KERN_WARNING KBUILD_MODNAME
2911+
": bad module parameter msi=%d; must be %d"
2912+
" (MSI-X or MSI) or %d (MSI)\n",
2913+
msi, MSI_MSIX, MSI_MSI);
2914+
return -EINVAL;
2915+
}
2916+
29182917
/* Debugfs support is optional, just warn if this fails */
29192918
cxgb4vf_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
29202919
if (!cxgb4vf_debugfs_root)

0 commit comments

Comments
 (0)