From: Dan Carpenter <dan.carpenter@oracle.com>
To: leon@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/restrack: Convert internal DB from hash to XArray
Date: Wed, 16 Dec 2020 11:24:35 +0300 [thread overview]
Message-ID: <X9nEQ9JjSJXVHNSq@mwanda> (raw)
[ I don't know why this warning is only showing up now but I grepped my
outbox and apparently it's new... *shrug* -dan ]
Hello Leon Romanovsky,
The patch fd47c2f99f04: "RDMA/restrack: Convert internal DB from hash
to XArray" from Feb 18, 2019, leads to the following static checker
warning:
drivers/infiniband/core/restrack.c:261 rdma_restrack_add()
warn: 'ret' can be either negative or positive
drivers/infiniband/core/restrack.c
220 void rdma_restrack_add(struct rdma_restrack_entry *res)
221 {
222 struct ib_device *dev = res_to_dev(res);
223 struct rdma_restrack_root *rt;
224 int ret = 0;
225
226 if (!dev)
227 return;
228
229 if (res->no_track)
230 goto out;
231
232 rt = &dev->res[res->type];
233
234 if (res->type == RDMA_RESTRACK_QP) {
235 /* Special case to ensure that LQPN points to right QP */
236 struct ib_qp *qp = container_of(res, struct ib_qp, res);
237
238 WARN_ONCE(qp->qp_num >> 24 || qp->port >> 8,
239 "QP number 0x%0X and port 0x%0X", qp->qp_num,
240 qp->port);
241 res->id = qp->qp_num;
242 if (qp->qp_type == IB_QPT_SMI || qp->qp_type == IB_QPT_GSI)
243 res->id |= qp->port << 24;
244 ret = xa_insert(&rt->xa, res->id, res, GFP_KERNEL);
245 if (ret)
246 res->id = 0;
247 } else if (res->type == RDMA_RESTRACK_COUNTER) {
248 /* Special case to ensure that cntn points to right counter */
249 struct rdma_counter *counter;
250
251 counter = container_of(res, struct rdma_counter, res);
252 ret = xa_insert(&rt->xa, counter->id, res, GFP_KERNEL);
253 res->id = ret ? 0 : counter->id;
254 } else {
255 ret = xa_alloc_cyclic(&rt->xa, &res->id, res, xa_limit_32b,
^^^^^^^^^^^^^^^
This sometimes returns 1 on success.
256 &rt->next_id, GFP_KERNEL);
257 }
258
259 out:
260 if (!ret)
if (ret >= 0)?
261 res->valid = true;
262 }
regards,
dan carpenter
reply other threads:[~2020-12-16 8:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=X9nEQ9JjSJXVHNSq@mwanda \
--to=dan.carpenter@oracle.com \
--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