diff mbox series

[27/38] net/sfc: free MAE lock once switch domain is assigned

Message ID 20210827065717.1838258-28-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series net/sfc: support port representors | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Aug. 27, 2021, 6:57 a.m. UTC
From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>

If for some reason the hardware switch ID initialization function fails,
MAE lock is still held after the function finishes. This patch fixes that.

Fixes: 1e7fbdf0ba19 ("net/sfc: support concept of switch domains/ports")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/net/sfc/sfc_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c
index c37cdf4a61..80c884a599 100644
--- a/drivers/net/sfc/sfc_switch.c
+++ b/drivers/net/sfc/sfc_switch.c
@@ -214,9 +214,9 @@  sfc_mae_assign_switch_domain(struct sfc_adapter *sa,
 
 fail_mem_alloc:
 	sfc_hw_switch_id_fini(sa, hw_switch_id);
-	rte_spinlock_unlock(&sfc_mae_switch.lock);
 
 fail_hw_switch_id_init:
+	rte_spinlock_unlock(&sfc_mae_switch.lock);
 	return rc;
 }