Commit cab30a98 authored by Alexey Kodanev's avatar Alexey Kodanev Committed by Leon Romanovsky

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: 4ab39e2f ("RDMA/cxgb4: Make c4iw_poll_cq_one() easier to analyze")
Signed-off-by: default avatarAlexey Kodanev <aleksei.kodanev@bell-sw.com>
Link: https://lore.kernel.org/r/20221215123030.155378-1-aleksei.kodanev@bell-sw.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 1b8ba6e4
...@@ -767,7 +767,7 @@ static int __c4iw_poll_cq_one(struct c4iw_cq *chp, struct c4iw_qp *qhp, ...@@ -767,7 +767,7 @@ static int __c4iw_poll_cq_one(struct c4iw_cq *chp, struct c4iw_qp *qhp,
goto out; goto out;
wc->wr_id = cookie; wc->wr_id = cookie;
wc->qp = qhp ? &qhp->ibqp : NULL; wc->qp = &qhp->ibqp;
wc->vendor_err = CQE_STATUS(&cqe); wc->vendor_err = CQE_STATUS(&cqe);
wc->wc_flags = 0; wc->wc_flags = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment