From: Jack Wang <jinpu.wang@cloud.ionos.com>
To: linux-rdma@vger.kernel.org
Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com,
jgg@ziepe.ca, danil.kipnis@cloud.ionos.com,
jinpu.wang@cloud.ionos.com, Gioh Kim <gi-oh.kim@cloud.ionos.com>
Subject: [PATCH for-next 09/13] RDMA/rtrs-clt: remove duplicated code
Date: Mon, 12 Oct 2020 15:18:10 +0200 [thread overview]
Message-ID: <20201012131814.121096-10-jinpu.wang@cloud.ionos.com> (raw)
In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com>
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
process_info_rsp checks that sg_cnt is zero twice.
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index f63f239bbf55..102df6898339 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2257,8 +2257,12 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
int i, sgi;
sg_cnt = le16_to_cpu(msg->sg_cnt);
- if (unlikely(!sg_cnt))
+ if (unlikely(!sg_cnt || (sess->queue_depth % sg_cnt))) {
+ rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n",
+ sg_cnt);
return -EINVAL;
+ }
+
/*
* Check if IB immediate data size is enough to hold the mem_id and
* the offset inside the memory chunk.
@@ -2271,11 +2275,6 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
MAX_IMM_PAYL_BITS, sg_cnt, sess->chunk_size);
return -EINVAL;
}
- if (unlikely(!sg_cnt || (sess->queue_depth % sg_cnt))) {
- rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n",
- sg_cnt);
- return -EINVAL;
- }
total_len = 0;
for (sgi = 0, i = 0; sgi < sg_cnt && i < sess->queue_depth; sgi++) {
const struct rtrs_sg_desc *desc = &msg->desc[sgi];
--
2.25.1
next prev parent reply other threads:[~2020-10-12 13:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 13:18 [PATCH for-next 00/13] rtrs: misc fix and cleanup Jack Wang
2020-10-12 13:18 ` [PATCH for-next 01/13] RDMA/rtrs-clt: remove destroy_con_cq_qo in case route resolving failed Jack Wang
2020-10-12 13:18 ` [PATCH for-next 02/13] RDMA/rtrs-clt: remove outdated comment in create_con_cq_qp Jack Wang
2020-10-12 13:18 ` [PATCH for-next 03/13] RDMA/rtrs-clt: avoid run destroy_con_cq_qp/create_con_cq_qp in parallel Jack Wang
2020-10-12 13:18 ` [PATCH for-next 04/13] RDMA/rtrs-clt: remove unnecessary dev_ref of rtrs_sess Jack Wang
2020-10-13 14:22 ` Jinpu Wang
2020-10-12 13:18 ` [PATCH for-next 05/13] RDMA/rtrs: removed unused filed list of rtrs_iu Jack Wang
2020-10-12 13:25 ` Jinpu Wang
2020-10-12 13:18 ` [PATCH for-next 06/13] RDMA/rtrs: remove unnecessary argument dir of rtrs_iu_free Jack Wang
2020-10-12 13:18 ` [PATCH for-next 07/13] RDMA/rtrs-clt: remove duplicated switch-case handling for CM error events Jack Wang
2020-10-12 13:18 ` [PATCH for-next 08/13] RDMA/ibtrs-clt: missing error from rtrs_rdma_conn_established Jack Wang
2020-10-12 13:23 ` Jinpu Wang
2020-10-12 13:18 ` Jack Wang [this message]
2020-10-12 13:18 ` [PATCH for-next 10/13] RDMA/rtrs-srv: fix typo Jack Wang
2020-10-12 13:18 ` [PATCH for-next 11/13] RDMA/rtrs-srv: kill rtrs_srv_change_state_get_old Jack Wang
2020-10-12 13:18 ` [PATCH for-next 12/13] RDMA/rtrs: introduce rtrs_post_send Jack Wang
2020-10-12 13:18 ` [PATCH for-next 13/13] RDMA/rtrs-clt: remove 'addr' from rtrs_clt_add_path_to_arr Jack Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201012131814.121096-10-jinpu.wang@cloud.ionos.com \
--to=jinpu.wang@cloud.ionos.com \
--cc=bvanassche@acm.org \
--cc=danil.kipnis@cloud.ionos.com \
--cc=dledford@redhat.com \
--cc=gi-oh.kim@cloud.ionos.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).