lkml.org 
[lkml]   [2021]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rdma: delete the useless casting value returned
On Fri, Mar 12, 2021 at 10:19:30AM +0800, Wang Qing wrote:
> 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

\
 
 \ /
  Last update: 2021-03-12 14:11    [W:0.764 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site