diff options
author | Michael Chan <mchan@broadcom.com> | 2013-08-07 00:50:07 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-07 19:44:03 +0200 |
commit | 02481bc678076f05643e7b240b2ea7c9aa1e72e1 (patch) | |
tree | 039ce344bb519e08558da93d61ae3328869e0792 /drivers/net/ethernet/broadcom/bnx2.c | |
parent | be2net: update driver version (diff) | |
download | linux-02481bc678076f05643e7b240b2ea7c9aa1e72e1.tar.xz linux-02481bc678076f05643e7b240b2ea7c9aa1e72e1.zip |
bnx2: Handle error condition in ->slot_reset()
by closing the device if necessary. Otherwise, since NAPI state is
already disabled, a subsequent close will hang the system.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 6a2de1d79ff6..3baf8b5631f9 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -8694,14 +8694,13 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); struct bnx2 *bp = netdev_priv(dev); - pci_ers_result_t result; - int err; + pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT; + int err = 0; rtnl_lock(); if (pci_enable_device(pdev)) { dev_err(&pdev->dev, "Cannot re-enable PCI device after reset\n"); - result = PCI_ERS_RESULT_DISCONNECT; } else { pci_set_master(pdev); pci_restore_state(pdev); @@ -8709,9 +8708,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) if (netif_running(dev)) { bnx2_set_power_state(bp, PCI_D0); - bnx2_init_nic(bp, 1); + err = bnx2_init_nic(bp, 1); } - result = PCI_ERS_RESULT_RECOVERED; + if (!err) + result = PCI_ERS_RESULT_RECOVERED; + } + + if (result != PCI_ERS_RESULT_RECOVERED && netif_running(dev)) { + bnx2_napi_enable(bp); + dev_close(dev); } rtnl_unlock(); |