From: Potnuri Bharat Teja <bharat@chelsio.com>
To: jgg@ziepe.ca, dledford@redhat.com
Cc: linux-rdma@vger.kernel.org, bharat@chelsio.com,
nirranjan@chelsio.com, Rahul Kundu <rahul.kundu@chelsio.com>
Subject: [PATCH rdma-core] cxgb4: always query device before initializing chip version
Date: Mon, 4 Nov 2019 17:56:08 +0530 [thread overview]
Message-ID: <1572870368-8686-1-git-send-email-bharat@chelsio.com> (raw)
chip_version may be initialized wrongly if alloc_context() is
invoked multiple times. therefore always query device to derive the
correct chip_version.
Fixes: c7e71b250268 ("cxgb4: fix chipversion initialization")
Signed-off-by: Rahul Kundu <rahul.kundu@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
providers/cxgb4/dev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index 4d02c7a91892..6526a7170fce 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -143,14 +143,14 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
}
verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops);
+ ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
+ &raw_fw_ver, &qcmd, sizeof(qcmd));
+ if (ret)
+ goto err_unmap;
if (!rhp->mmid2ptr) {
int ret;
- ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
- &raw_fw_ver, &qcmd, sizeof(qcmd));
- if (ret)
- goto err_unmap;
rhp->max_mr = attr.max_mr;
rhp->mmid2ptr = calloc(attr.max_mr, sizeof(void *));
if (!rhp->mmid2ptr) {
--
2.3.9
next reply other threads:[~2019-11-04 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 12:26 Potnuri Bharat Teja [this message]
2019-11-05 14:45 ` [PATCH rdma-core] cxgb4: always query device before initializing chip version Leon Romanovsky
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=1572870368-8686-1-git-send-email-bharat@chelsio.com \
--to=bharat@chelsio.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=nirranjan@chelsio.com \
--cc=rahul.kundu@chelsio.com \
/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