Blame SOURCES/0009-cxgb4-always-query-device-before-initializing-chip-v.patch

bbe12a
From 3146dd6503fbb87b311caae47eeac739dc59bfd3 Mon Sep 17 00:00:00 2001
bbe12a
From: Potnuri Bharat Teja <bharat@chelsio.com>
bbe12a
Date: Mon, 4 Nov 2019 17:18:25 +0530
bbe12a
Subject: [PATCH rdma-core 09/13] cxgb4: always query device before
bbe12a
 initializing chip version
bbe12a
bbe12a
[ Upstream commit df720f3658ca49aea89cb6e8f11980f30574d10a ]
bbe12a
bbe12a
chip_version may be initialized wrongly if alloc_context() is
bbe12a
invoked multiple times. therefore always query device to derive the
bbe12a
correct chip_version.
bbe12a
bbe12a
Fixes: c7e71b250268 ("cxgb4: fix chipversion initialization")
bbe12a
Signed-off-by: Rahul Kundu <rahul.kundu@chelsio.com>
bbe12a
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
bbe12a
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
bbe12a
---
bbe12a
 providers/cxgb4/dev.c | 9 +++------
bbe12a
 1 file changed, 3 insertions(+), 6 deletions(-)
bbe12a
bbe12a
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
bbe12a
index 4d02c7a9..ecd87e6c 100644
bbe12a
--- a/providers/cxgb4/dev.c
bbe12a
+++ b/providers/cxgb4/dev.c
bbe12a
@@ -143,14 +143,11 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
bbe12a
 	} 
bbe12a
 
bbe12a
 	verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops);
bbe12a
+	if (ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
bbe12a
+				 &raw_fw_ver, &qcmd, sizeof(qcmd)))
bbe12a
+		goto err_unmap;
bbe12a
 
bbe12a
 	if (!rhp->mmid2ptr) {
bbe12a
-		int ret;
bbe12a
-
bbe12a
-		ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
bbe12a
-					   &raw_fw_ver, &qcmd, sizeof(qcmd));
bbe12a
-		if (ret)
bbe12a
-			goto err_unmap;
bbe12a
 		rhp->max_mr = attr.max_mr;
bbe12a
 		rhp->mmid2ptr = calloc(attr.max_mr, sizeof(void *));
bbe12a
 		if (!rhp->mmid2ptr) {
bbe12a
-- 
bbe12a
2.20.1
bbe12a