diff mbox series

[rdma-core] cxgb4: always query device before initializing chip version

Message ID 1572870368-8686-1-git-send-email-bharat@chelsio.com (mailing list archive)
State Accepted
Headers show
Series [rdma-core] cxgb4: always query device before initializing chip version | expand

Commit Message

Potnuri Bharat Teja Nov. 4, 2019, 12:26 p.m. UTC
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(-)

Comments

Leon Romanovsky Nov. 5, 2019, 2:45 p.m. UTC | #1
On Mon, Nov 04, 2019 at 05:56:08PM +0530, Potnuri Bharat Teja wrote:
> 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(-)
>

Thanks, applied.
diff mbox series

Patch

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) {