summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
diff options
context:
space:
mode:
authorSomnath Kotur <somnath.kotur@broadcom.com>2018-10-08 03:27:58 -0700
committerJason Gunthorpe <jgg@mellanox.com>2018-10-16 00:03:50 -0600
commitbb22c36cbaaeff351b8a6956d88be98497cc14aa (patch)
tree39b8e0eec3b499094c79c0e1f4601c1fc104d614 /drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
parentf2bd4d096eb4e0074b476452789a3b10a31af162 (diff)
downloadblackbird-obmc-linux-bb22c36cbaaeff351b8a6956d88be98497cc14aa.tar.gz
blackbird-obmc-linux-bb22c36cbaaeff351b8a6956d88be98497cc14aa.zip
RDMA/bnxt_re: Prevent driver crash due to NULL pointer in error message print
crsqe->resp would be NULL in case the host command timed out before getting a response from HW. Check for NULL pointer to avoid a potential crash while printing the error message. Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/bnxt_re/qplib_rcfw.c')
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_rcfw.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
index a3d9447c3aee..be4e33e9f962 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
@@ -333,10 +333,12 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
crsqe->resp = NULL;
} else {
- dev_err(&rcfw->pdev->dev,
- "CMD %s resp->cookie = %#x, evnt->cookie = %#x\n",
- crsqe->resp ? "mismatch" : "collision",
- crsqe->resp ? crsqe->resp->cookie : 0, mcookie);
+ if (crsqe->resp && crsqe->resp->cookie)
+ dev_err(&rcfw->pdev->dev,
+ "CMD %s cookie sent=%#x, recd=%#x\n",
+ crsqe->resp ? "mismatch" : "collision",
+ crsqe->resp ? crsqe->resp->cookie : 0,
+ mcookie);
}
if (!test_and_clear_bit(cbit, rcfw->cmdq_bitmap))
dev_warn(&rcfw->pdev->dev,
OpenPOWER on IntegriCloud