Skip to content

Commit a0403be

Browse files
oulijundledford
authored andcommitted
RDMA/hns: Fix the bug with NULL pointer
When the last QP of eight QPs is not exist in hns_roce_v1_mr_free_work_fn function, the print for qpn of hr_qp may introduce a calltrace for NULL pointer. Signed-off-by: Lijun Ou <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 79d4420 commit a0403be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
10371037

10381038
do {
10391039
ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
1040-
if (ret < 0) {
1040+
if (ret < 0 && hr_qp) {
10411041
dev_err(dev,
10421042
"(qp:0x%lx) starts, Poll cqe failed(%d) for mr 0x%x free! Remain %d cqe\n",
10431043
hr_qp->qpn, ret, hr_mr->key, ne);

0 commit comments

Comments
 (0)