Blob Blame History Raw
From 6224dddff248c8c2870061195aed015df77bee08 Mon Sep 17 00:00:00 2001
From: Jonathan Toppins <jtoppins@redhat.com>
Date: Fri, 6 Dec 2019 20:12:45 -0500
Subject: [PATCH 89/96] [netdrv] bnxt_en: Avoid disabling pci device in
 bnxt_remove_one() for already disabled device

Message-id: <d5efe4e8687cf682dc2f92c6be82552e027cb2e3.1575651771.git.jtoppins@redhat.com>
Patchwork-id: 291383
O-Subject: [PATCH rhel8 05/13] bnxt_en: Avoid disabling pci device in bnxt_remove_one() for already disabled device.
Bugzilla: 1773724
RH-Acked-by: Steve Best <sbest@redhat.com>
RH-Acked-by: David Arcari <darcari@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
RH-Acked-by: John Linville <linville@redhat.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>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
(cherry picked from commit f6824308c4be25ba024ab942a6135aa0356acaea)
Bugzilla: 1773724
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=25154853
Tested: simple boot test
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.c
===================================================================
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:23:22.071454764 +0100
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:23:22.325452432 +0100
@@ -10387,7 +10387,8 @@
 {
 	bnxt_unmap_bars(bp, bp->pdev);
 	pci_release_regions(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)