diff mbox series

[v5,net-next,10/10] qede: make driver reliable on unload after failures

Message ID 20200802100834.383-11-irusskikh@marvell.com
State Changes Requested
Delegated to: David Miller
Headers show
Series qed: introduce devlink health support | expand

Commit Message

Igor Russkikh Aug. 2, 2020, 10:08 a.m. UTC
In case recovery was not successful, netdev still should be
present. But we should clear cdev if something bad happens
on recovery.

We also check cdev for null on dev close. That could be a case
if recovery was not successful.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
 drivers/net/ethernet/qlogic/qede/qede_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 287e10effb49..01a7bff91d6c 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1240,7 +1240,10 @@  static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 	qede_rdma_dev_remove(edev, (mode == QEDE_PROBE_RECOVERY));
-	free_netdev(edev->ndev);
+	if (mode != QEDE_PROBE_RECOVERY)
+		free_netdev(edev->ndev);
+	else
+		edev->cdev = NULL;
@@ -2475,7 +2478,8 @@  static int qede_close(struct net_device *ndev)
 	qede_unload(edev, QEDE_UNLOAD_NORMAL, false);
-	edev->ops->common->update_drv_state(edev->cdev, false);
+	if (edev->cdev)
+		edev->ops->common->update_drv_state(edev->cdev, false);
 	return 0;