Skip to contentSkip to conversation

cxgb4: always query device before initializing chip version

PATCH Applied Potnuri Bharat Teja 2 participants 2 messages Nov 4, 2019 – Nov 5, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: always query device before initializing chip version

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")
---
 providers/cxgb4/dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
providers/cxgb4/dev.c +4 -4
index 4d02c7a91892..6526a7170fce 100644
@@ -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) {
Signature · 1 line
2.3.9
#1 lore raw
Quoted 11 lines · Potnuri Bharat Teja

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")
---
 providers/cxgb4/dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Thanks, applied.