From 95f3cc1f25c091f97aefceac268fe6435d0861c3 Mon Sep 17 00:00:00 2001
From: Ran Zhou <zhouran10@partner.com>
Date: Mon, 27 Nov 2023 16:39:48 +0800
Subject: [PATCH 71/75] libhns: Corrects several issues with output format and
 variable types.

driver inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2S3?from=project-issue

--------------------------------------------------------------------------
1.Unify the types of two variables to avoid infinite loop.

2.Standardization the output control character.

Signed-off-by: Luoyouming <luoyouming@huawei.com>
---
 providers/hns/hns_roce_u.c       |  2 +-
 providers/hns/hns_roce_u_hw_v2.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 084385b..f30486f 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -179,7 +179,7 @@ static void set_dca_pool_param(struct hns_roce_context *ctx,
 		dca_ctx->min_size = HNS_DCA_MAX_MEM_SIZE;
 
 	verbs_debug(&ctx->ibv_ctx,
-		    "Support DCA, unit %d, max %ld, min %ld Bytes.\n",
+		    "Support DCA, unit %u, max %lu, min %lu Bytes.\n",
 		    dca_ctx->unit_size, dca_ctx->max_size, dca_ctx->min_size);
 }
 
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 495fbcb..754f918 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2680,8 +2680,8 @@ static void set_inline_data_list_rc(struct hns_roce_qp *qp,
 {
 	unsigned int msg_len = qp->sge_info.total_len;
 	void *dseg;
+	size_t i;
 	int ret;
-	int i;
 
 	hr_reg_enable(wqe, RCWQE_INLINE);
 
@@ -2741,7 +2741,7 @@ static void wr_set_inline_data_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_buf,
 {
 	struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
 	struct hns_roce_rc_sq_wqe *wqe = qp->cur_wqe;
-	int i;
+	size_t i;
 
 	if (!wqe)
 		return;
@@ -2872,7 +2872,7 @@ static void wr_set_sge_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_sge,
 	}
 
 	hr_reg_write(wqe, UDWQE_MSG_START_SGE_IDX, sge_idx & mask);
-	for (int i = 0; i < num_sge; i++) {
+	for (size_t i = 0; i < num_sge; i++) {
 		if (!sg_list[i].length)
 			continue;
 
@@ -2899,8 +2899,8 @@ static void set_inline_data_list_ud(struct hns_roce_qp *qp,
 	uint8_t data[HNS_ROCE_MAX_UD_INL_INN_SZ] = {};
 	unsigned int msg_len = qp->sge_info.total_len;
 	void *tmp;
+	size_t i;
 	int ret;
-	int i;
 
 	if (!check_inl_data_len(qp, msg_len)) {
 		qp->err = EINVAL;
@@ -2962,7 +2962,7 @@ static void wr_set_inline_data_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_buf,
 {
 	struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
 	struct hns_roce_ud_sq_wqe *wqe = qp->cur_wqe;
-	int i;
+	size_t i;
 
 	if (!wqe)
 		return;
-- 
2.25.1

