From: Li Haoran
Date: Tue, 1 Apr 2025 13:10:15 +0000 (+0800)
Subject: RDMA/core: Convert to use ERR_CAST()
X-Git-Tag: v6.16-rc1~111^2~55
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a94c42d831092ba65ce88bda020d93d2e267fe4;p=thirdparty%2Fkernel%2Flinux.git
RDMA/core: 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.
Link: https://patch.msgid.link/r/20250401211015750qxOfU9XZ8QgKizM1Lcyq2@zte.com.cn
Signed-off-by: Li Haoran
Signed-off-by: Shao Mingyin
Signed-off-by: Jason Gunthorpe
---
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index c5e78bbefbd02..75fde0fe99899 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -572,7 +572,7 @@ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
GFP_KERNEL : GFP_ATOMIC);
if (IS_ERR(slave)) {
rdma_unfill_sgid_attr(ah_attr, old_sgid_attr);
- return (void *)slave;
+ return ERR_CAST(slave);
}
ah = _rdma_create_ah(pd, ah_attr, flags, NULL, slave);
rdma_lag_put_ah_roce_slave(slave);