rdma: delete the useless casting value returned
PATCH 1/1 rdma: delete the useless casting value returned
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.
Signed-off-by Wang Qing <[email protected]>
--- include/rdma/ib_verbs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/rdma/ib_verbs.h +1 -1
@@ -2259,7 +2259,7 @@ struct iw_cm_conn_param; struct ib_struct)))#define rdma_zalloc_drv_obj_gfp (ib_dev, ib_type, gfp) \ - ((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, gfp)) + kzalloc(ib_dev->ops.size_##ib_type, gfp)#define rdma_zalloc_drv_obj (ib_dev, ib_type) \ rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, GFP_KERNEL)
Signature · 1 line
2.7.4
Jason Gunthorpe
maintainerQuoted 2 lines · Wang Qing
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.
This warning is wrong in this specific case.
The #define is creating a helper function that enforces strict type safety on the user
So eg,
struct bar *obj = rdma_zalloc_drv_obj(ibdev, ib_ah);
Will fail to compile because 'obj' is not the required ib_ah type
Jason