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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
Signed-off-by: Potnuri Bharat Teja <bharat@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux