]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/core: Convert to use ERR_CAST()
authorLi Haoran <li.haoran7@zte.com.cn>
Tue, 1 Apr 2025 13:10:15 +0000 (21:10 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 7 Apr 2025 18:12:07 +0000 (15:12 -0300)
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 <li.haoran7@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/verbs.c

index c5e78bbefbd026f013a8cb46c1400ea5ba6a921c..75fde0fe998992e3de4226b568b1a6f261c39c01 100644 (file)
@@ -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);