diff mbox series

[net] ibmvnic: Set to CLOSED state even on error

Message ID 20210210071538.GB852317@us.ibm.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] ibmvnic: Set to CLOSED state even on error | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net
netdev/tree_selection success Clearly marked for net

Commit Message

Sukadev Bhattiprolu Feb. 10, 2021, 7:15 a.m. UTC
From f6a04bc0abfae1065577888fc6467f9f162863f6 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
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.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index e51a7f2d00cb..1ec0dca80738 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -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)