Commit e012316d authored by Shen Lichuan's avatar Shen Lichuan Committed by Leon Romanovsky

RDMA/rdmavt: Convert to use ERR_CAST()

As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Signed-off-by: default avatarShen Lichuan <shenlichuan@vivo.com>
Link: https://patch.msgid.link/20240828082720.33231-1-shenlichuan@vivo.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 2d10b05b
...@@ -348,13 +348,13 @@ struct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, ...@@ -348,13 +348,13 @@ struct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
umem = ib_umem_get(pd->device, start, length, mr_access_flags); umem = ib_umem_get(pd->device, start, length, mr_access_flags);
if (IS_ERR(umem)) if (IS_ERR(umem))
return (void *)umem; return ERR_CAST(umem);
n = ib_umem_num_pages(umem); n = ib_umem_num_pages(umem);
mr = __rvt_alloc_mr(n, pd); mr = __rvt_alloc_mr(n, pd);
if (IS_ERR(mr)) { if (IS_ERR(mr)) {
ret = (struct ib_mr *)mr; ret = ERR_CAST(mr);
goto bail_umem; goto bail_umem;
} }
...@@ -542,7 +542,7 @@ struct ib_mr *rvt_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, ...@@ -542,7 +542,7 @@ struct ib_mr *rvt_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
mr = __rvt_alloc_mr(max_num_sg, pd); mr = __rvt_alloc_mr(max_num_sg, pd);
if (IS_ERR(mr)) if (IS_ERR(mr))
return (struct ib_mr *)mr; return ERR_CAST(mr);
return &mr->ibmr; return &mr->ibmr;
} }
......
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