[PATCH] dma-buf: Remove unnecessary kmalloc() cast

From: Thorsten Blum
Date: Sat Jun 29 2024 - 21:13:28 EST


Casting the return value of kmalloc() is unnecessary and can be
removed. Remove it and fix the following Coccinelle/coccicheck warning
reported by alloc_cast.cocci:

WARNING: casting value returned by memory allocation function to (struct dma_fence_chain *) is useless.

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>
---
include/linux/dma-fence-chain.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-fence-chain.h b/include/linux/dma-fence-chain.h
index ad9e2506c2f4..a9dc82e1b7f3 100644
--- a/include/linux/dma-fence-chain.h
+++ b/include/linux/dma-fence-chain.h
@@ -87,7 +87,7 @@ dma_fence_chain_contained(struct dma_fence *fence)
* Returns a new struct dma_fence_chain object or NULL on failure.
*/
#define dma_fence_chain_alloc() \
- ((struct dma_fence_chain *)kmalloc(sizeof(struct dma_fence_chain), GFP_KERNEL))
+ kmalloc(sizeof(struct dma_fence_chain), GFP_KERNEL)

/**
* dma_fence_chain_free
--
2.39.2