RDMA/rxe: Remove unnecessary mr testing
authorLi Zhijian <lizhijian@fujitsu.com>
Mon, 24 Oct 2022 03:31:54 +0000 (03:31 +0000)
committerLeon Romanovsky <leon@kernel.org>
Tue, 25 Oct 2022 05:56:32 +0000 (08:56 +0300)
Before the testing, we already passed it to rxe_mr_copy() where mr could
be dereferenced. so this checking is not needed.

The only way that mr is NULL is when it reaches below line 780 with
 'qp->resp.mr = NULL', which is not possible in Bob's explanation[1].

 778         if (res->state == rdatm_res_state_new) {
 779                 if (!res->replay) {
 780                         mr = qp->resp.mr;
 781                         qp->resp.mr = NULL;
 782                 } else {

[1] https://lore.kernel.org/lkml/30ff25c4-ce66-eac4-eaa2-64c0db203a19@gmail.com/

Link: https://lore.kernel.org/r/1666582315-2-1-git-send-email-lizhijian@fujitsu.com
CC: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/sw/rxe/rxe_resp.c

index 82b74e9..95d372d 100644 (file)
@@ -811,8 +811,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
        err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
                          payload, RXE_FROM_MR_OBJ);
-       if (mr)
-               rxe_put(mr);
+       rxe_put(mr);
        if (err) {
                kfree_skb(skb);
                return RESPST_ERR_RKEY_VIOLATION;