Skip to contentSkip to conversation

ibmvnic: Set to CLOSED state even on error

PATCH New Sukadev Bhattiprolu 1 participant 1 message Feb 10, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvnic: Set to CLOSED state even on error

From f6a04bc0abfae1065577888fc6467f9f162863f6 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <[email protected]>
Date: Wed, 3 Feb 2021 13:15:23 -0800
Subject: [PATCH net] ibmvnic: Set to CLOSED state even on error

If set_link_state() fails for any reason, we still cleanup the adapter state and cannot recover from a partial close anyway. Also, the reset functions do not check for the CLOSING state. So better to set adapter to CLOSED state.

Found this while investigating a problem reported by Abdul Haleem.

---
 drivers/net/ethernet/ibm/ibmvnic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +1 -3
index e51a7f2d00cb..1ec0dca80738 100644
@@ -1367,10 +1367,8 @@ static int __ibmvnic_close(struct net_device *netdev)
 
 	adapter->state = VNIC_CLOSING;
 	rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
-	if (rc)
-		return rc;
 	adapter->state = VNIC_CLOSED;
-	return 0;
+	return rc;
 }
 
 static int ibmvnic_close(struct net_device *netdev)
Signature · 1 line
2.26.2