Commit 02481bc6 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5721f943
...@@ -8694,14 +8694,13 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) ...@@ -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 net_device *dev = pci_get_drvdata(pdev);
struct bnx2 *bp = netdev_priv(dev); struct bnx2 *bp = netdev_priv(dev);
pci_ers_result_t result; pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
int err; int err = 0;
rtnl_lock(); rtnl_lock();
if (pci_enable_device(pdev)) { if (pci_enable_device(pdev)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Cannot re-enable PCI device after reset\n"); "Cannot re-enable PCI device after reset\n");
result = PCI_ERS_RESULT_DISCONNECT;
} else { } else {
pci_set_master(pdev); pci_set_master(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
...@@ -8709,9 +8708,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) ...@@ -8709,9 +8708,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
if (netif_running(dev)) { if (netif_running(dev)) {
bnx2_set_power_state(bp, PCI_D0); 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(); rtnl_unlock();
......
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