Commit 0caa9aae authored by Rasesh Mody's avatar Rasesh Mody Committed by David S. Miller

bna: PCI Probe Fix

Change details:
 - Return error as -EIO if bnad_res_alloc fails
 - Release the configuration lock before registering with net_device layer.
Signed-off-by: default avatarGurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: default avatarRasesh Mody <rmody@brocade.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 772b5235
...@@ -3253,8 +3253,10 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3253,8 +3253,10 @@ bnad_pci_probe(struct pci_dev *pdev,
spin_unlock_irqrestore(&bnad->bna_lock, flags); spin_unlock_irqrestore(&bnad->bna_lock, flags);
err = bnad_res_alloc(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX); err = bnad_res_alloc(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX);
if (err) if (err) {
err = -EIO;
goto disable_ioceth; goto disable_ioceth;
}
spin_lock_irqsave(&bnad->bna_lock, flags); spin_lock_irqsave(&bnad->bna_lock, flags);
bna_mod_init(&bnad->bna, &bnad->mod_res_info[0]); bna_mod_init(&bnad->bna, &bnad->mod_res_info[0]);
...@@ -3266,6 +3268,8 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3266,6 +3268,8 @@ bnad_pci_probe(struct pci_dev *pdev,
bnad_set_netdev_perm_addr(bnad); bnad_set_netdev_perm_addr(bnad);
spin_unlock_irqrestore(&bnad->bna_lock, flags); spin_unlock_irqrestore(&bnad->bna_lock, flags);
mutex_unlock(&bnad->conf_mutex);
/* Finally, reguister with net_device layer */ /* Finally, reguister with net_device layer */
err = register_netdev(netdev); err = register_netdev(netdev);
if (err) { if (err) {
...@@ -3274,6 +3278,8 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3274,6 +3278,8 @@ bnad_pci_probe(struct pci_dev *pdev,
} }
set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags); set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags);
return 0;
probe_success: probe_success:
mutex_unlock(&bnad->conf_mutex); mutex_unlock(&bnad->conf_mutex);
return 0; return 0;
......
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