[net,5/5] bnxt_en: Avoid disabling pci device in bnxt_remove_one() for already disabled device.
diff mbox series

Message ID 1571636069-14179-6-git-send-email-michael.chan@broadcom.com
State Accepted
Delegated to: David Miller
Headers show
  • bnxt_en: Bug fixes.
Related show

Commit Message

Michael Chan Oct. 21, 2019, 5:34 a.m. UTC
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>

With the recently added error recovery logic, the device may already
be disabled if the firmware recovery is unsuccessful.  In
bnxt_remove_one(), check that the device is still enabled first
before calling pci_disable_device().

Fixes: 3bc7d4a352ef ("bnxt_en: Add BNXT_STATE_IN_FW_RESET state.")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 8492618..04ec909 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10382,7 +10382,8 @@  static void bnxt_cleanup_pci(struct bnxt *bp)
 	bnxt_unmap_bars(bp, bp->pdev);
-	pci_disable_device(bp->pdev);
+	if (pci_is_enabled(bp->pdev))
+		pci_disable_device(bp->pdev);
 static void bnxt_init_dflt_coal(struct bnxt *bp)