RDMA/rxe: Don't overwrite errno from ib_umem_get()
authorXiao Yang <yangx.jy@fujitsu.com>
Mon, 21 Jun 2021 07:14:56 +0000 (15:14 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 22 Jun 2021 00:05:02 +0000 (21:05 -0300)
rxe_mr_init_user() always returns the fixed -EINVAL when ib_umem_get()
fails so it's hard for user to know which actual error happens in
ib_umem_get(). For example, ib_umem_get() will return -EOPNOTSUPP when
trying to pin pages on a DAX file.

Return actual error as mlx4/mlx5 does.

Link: https://lore.kernel.org/r/20210621071456.4259-1-ice_yangxiao@163.com
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_mr.c

index 7f16932..6aabcb4 100644 (file)
@@ -118,7 +118,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
        if (IS_ERR(umem)) {
                pr_warn("err %d from rxe_umem_get\n",
                        (int)PTR_ERR(umem));
-               err = -EINVAL;
+               err = PTR_ERR(umem);
                goto err1;
        }