RDMA/rtrs: Fix some signedness bugs in error handling
[linux-2.6-microblaze.git] / drivers / infiniband / ulp / rtrs / rtrs-clt.c
index 468fdd0..96cba06 100644 (file)
@@ -1047,11 +1047,10 @@ static int rtrs_map_sg_fr(struct rtrs_clt_io_req *req, size_t count)
 
        /* Align the MR to a 4K page size to match the block virt boundary */
        nr = ib_map_mr_sg(req->mr, req->sglist, count, NULL, SZ_4K);
-       if (unlikely(nr < req->sg_cnt)) {
-               if (nr < 0)
-                       return nr;
+       if (nr < 0)
+               return nr;
+       if (unlikely(nr < req->sg_cnt))
                return -EINVAL;
-       }
        ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey));
 
        return nr;