*/
 void frwr_reset(struct rpcrdma_req *req)
 {
-       while (!list_empty(&req->rl_registered)) {
-               struct rpcrdma_mr *mr;
+       struct rpcrdma_mr *mr;
 
-               mr = rpcrdma_mr_pop(&req->rl_registered);
+       while ((mr = rpcrdma_mr_pop(&req->rl_registered)))
                rpcrdma_mr_unmap_and_put(mr);
-       }
 }
 
 /**
         */
        frwr = NULL;
        prev = &first;
-       while (!list_empty(&req->rl_registered)) {
-               mr = rpcrdma_mr_pop(&req->rl_registered);
+       while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
 
                trace_xprtrdma_mr_localinv(mr);
                r_xprt->rx_stats.local_inv_needed++;
         */
        frwr = NULL;
        prev = &first;
-       while (!list_empty(&req->rl_registered)) {
-               mr = rpcrdma_mr_pop(&req->rl_registered);
+       while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
 
                trace_xprtrdma_mr_localinv(mr);
                r_xprt->rx_stats.local_inv_needed++;
 
         * chunks. Very likely the connection has been replaced,
         * so these registrations are invalid and unusable.
         */
-       while (unlikely(!list_empty(&req->rl_registered))) {
-               struct rpcrdma_mr *mr;
-
-               mr = rpcrdma_mr_pop(&req->rl_registered);
-               rpcrdma_mr_recycle(mr);
-       }
+       frwr_reset(req);
 
        /* This implementation supports the following combinations
         * of chunk lists in one RPC-over-RDMA Call message:
 
 rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt)
 {
        struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
-       struct rpcrdma_mr *mr = NULL;
+       struct rpcrdma_mr *mr;
 
        spin_lock(&buf->rb_mrlock);
-       if (!list_empty(&buf->rb_mrs))
-               mr = rpcrdma_mr_pop(&buf->rb_mrs);
+       mr = rpcrdma_mr_pop(&buf->rb_mrs);
        spin_unlock(&buf->rb_mrlock);
-
        if (!mr)
                goto out_nomrs;
        return mr;
 
 static inline void
 rpcrdma_mr_push(struct rpcrdma_mr *mr, struct list_head *list)
 {
-       list_add_tail(&mr->mr_list, list);
+       list_add(&mr->mr_list, list);
 }
 
 static inline struct rpcrdma_mr *
 {
        struct rpcrdma_mr *mr;
 
-       mr = list_first_entry(list, struct rpcrdma_mr, mr_list);
-       list_del_init(&mr->mr_list);
+       mr = list_first_entry_or_null(list, struct rpcrdma_mr, mr_list);
+       if (mr)
+               list_del_init(&mr->mr_list);
        return mr;
 }