Skip to content

Commit cab30a9

Browse files
akodanevrleon
authored andcommitted
RDMA/cxgb4: remove unnecessary NULL check in __c4iw_poll_cq_one()
If 'qhp' is NULL then 'wq' is also NULL: struct t4_wq *wq = qhp ? &qhp->wq : NULL; ... ret = poll_cq(wq, ...); if (ret) goto out; poll_cq(wq, ...) always returns a non-zero status if 'wq' is NULL, either on a t4_next_cqe() error or on a 'wq == NULL' check. Therefore, checking 'qhp' again after poll_cq() is redundant. BTW, there're also 'qhp' dereference cases below poll_cq() without any checks (c4iw_invalidate_mr(qhp->rhp,...)). Detected using the static analysis tool - Svace. Fixes: 4ab39e2 ("RDMA/cxgb4: Make c4iw_poll_cq_one() easier to analyze") Signed-off-by: Alexey Kodanev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 1b8ba6e commit cab30a9

File tree

1 file changed

+1
-1
lines changed
  • drivers/infiniband/hw/cxgb4

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/cxgb4/cq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ static int __c4iw_poll_cq_one(struct c4iw_cq *chp, struct c4iw_qp *qhp,
767767
goto out;
768768

769769
wc->wr_id = cookie;
770-
wc->qp = qhp ? &qhp->ibqp : NULL;
770+
wc->qp = &qhp->ibqp;
771771
wc->vendor_err = CQE_STATUS(&cqe);
772772
wc->wc_flags = 0;
773773

0 commit comments

Comments
 (0)