On Thu, Apr 04, 2024 at 03:17:43PM -0700, Suren Baghdasaryan wrote: > Ironically, checkpatch generates warnings for these type casts: > > WARNING: unnecessary cast may hide bugs, see > http://c-faq.com/malloc/mallocnocast.html > #425: FILE: include/linux/dma-fence-chain.h:90: > + ((struct dma_fence_chain *)kmalloc(sizeof(struct dma_fence_chain), > GFP_KERNEL)) > > I guess I can safely ignore them in this case (since we cast to the > expected type)? I find ignoring checkpatch to be a solid move 99% of the time. I really don't like the codetags. This is so much churn, and it could all be avoided by just passing in _RET_IP_ or _THIS_IP_ depending on whether we wanted to profile this function or its caller. vmalloc has done it this way since 2008 (OK, using __builtin_return_address()) and lockdep has used _THIS_IP_ / _RET_IP_ since 2006.