Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Shen Lichuan <shenlichuan@vivo.com>
Link: https://patch.msgid.link/20240828082720.33231-1-shenlichuan@vivo.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Shen Lichuan and committed by
Leon Romanovsky
e012316d 2d10b05b

+3 -3
+3 -3
drivers/infiniband/sw/rdmavt/mr.c
··· 348 348 349 349 umem = ib_umem_get(pd->device, start, length, mr_access_flags); 350 350 if (IS_ERR(umem)) 351 - return (void *)umem; 351 + return ERR_CAST(umem); 352 352 353 353 n = ib_umem_num_pages(umem); 354 354 355 355 mr = __rvt_alloc_mr(n, pd); 356 356 if (IS_ERR(mr)) { 357 - ret = (struct ib_mr *)mr; 357 + ret = ERR_CAST(mr); 358 358 goto bail_umem; 359 359 } 360 360 ··· 542 542 543 543 mr = __rvt_alloc_mr(max_num_sg, pd); 544 544 if (IS_ERR(mr)) 545 - return (struct ib_mr *)mr; 545 + return ERR_CAST(mr); 546 546 547 547 return &mr->ibmr; 548 548 }