From 8759b0e6ec4e73994743c1ae0d0ecc186688b6d6 Mon Sep 17 00:00:00 2001
From: Ran Zhou <zhouran10@h-partners.com>
Date: Thu, 7 Dec 2023 09:48:01 +0800
Subject: [PATCH 79/80] libhns: Removes a repeated initialization of a spinlock

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

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

The pthread_spin_init() of qp was done in create_qp(). We removed
the spinlock init in this place to avoid initializing twice.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Ran Zhou <zhouran10@h-partners.com>
---
 providers/hns/hns_roce_u_verbs.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index ba3fef6..c404948 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -1933,10 +1933,6 @@ static int hns_roce_alloc_qp_buf(struct ibv_qp_init_attr_ex *attr,
 {
 	int ret;
 
-	if (pthread_spin_init(&qp->sq.hr_lock.lock, PTHREAD_PROCESS_PRIVATE) ||
-	    pthread_spin_init(&qp->rq.hr_lock.lock, PTHREAD_PROCESS_PRIVATE))
-		return -ENOMEM;
-
 	ret = qp_alloc_wqe(attr, hns_attr, qp, ctx);
 	if (ret)
 		return ret;
-- 
2.25.1

