public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: Remove unnecessary kmalloc() cast
@ 2024-06-30  1:12 Thorsten Blum
  2024-07-02  6:26 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Blum @ 2024-06-30  1:12 UTC (permalink / raw)
  To: akpm, jack, surenb; +Cc: linux-kernel, Thorsten Blum

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@toblux.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-03 17:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-30  1:12 [PATCH] dma-buf: Remove unnecessary kmalloc() cast Thorsten Blum
2024-07-02  6:26 ` Andrew Morton
2024-07-02  6:40   ` Christoph Hellwig
2024-07-02  7:13     ` Christian König
2024-07-02  7:33       ` Andrew Morton
2024-07-02  7:35         ` Christoph Hellwig
2024-07-02 15:15         ` Suren Baghdasaryan
2024-07-03 17:45           ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox