From a1e9d50eda32f05fe6af3712d1e70d3b6944528a Mon Sep 17 00:00:00 2001
From: Junxian Huang <huangjunxian6@hisilicon.com>
Date: Mon, 10 Mar 2025 11:47:23 +0800
Subject: [PATCH 96/96] libhns: Fix wrong order of spin_unlock in modify_qp

driver inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBSLL5

----------------------------------------------------------------------

The spin_unlock order should be the reverse of spin_lock() order.

Fixes: f29e2a7fa40d ("[PATCH] libhns: Add support for the thread domain and the parent domain")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index f05b839..70fe2f7 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -1936,8 +1936,8 @@ static int hns_roce_u_v2_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
 	if (flag) {
 		if (!ret)
 			qp->state = IBV_QPS_ERR;
-		hns_roce_spin_unlock(&hr_qp->sq.hr_lock);
 		hns_roce_spin_unlock(&hr_qp->rq.hr_lock);
+		hns_roce_spin_unlock(&hr_qp->sq.hr_lock);
 	}
 
 	if (ret)
-- 
2.33.0

