[RESEND PATCH] accel/habanalabs/gaudi2: Use kvfree() for memory allocated with kvcalloc()

Thorsten Blum posted 1 patch 1 year, 5 months ago
drivers/accel/habanalabs/gaudi2/gaudi2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[RESEND PATCH] accel/habanalabs/gaudi2: Use kvfree() for memory allocated with kvcalloc()
Posted by Thorsten Blum 1 year, 5 months ago
Use kvfree() to fix the following Coccinelle/coccicheck warning reported
by kfree_mismatch.cocci:

  WARNING kvmalloc is used to allocate this memory at line 10398

Reviewed-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 drivers/accel/habanalabs/gaudi2/gaudi2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c b/drivers/accel/habanalabs/gaudi2/gaudi2.c
index a38b88baadf2..5722e4128d3c 100644
--- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
@@ -10437,7 +10437,7 @@ static int gaudi2_memset_device_memory(struct hl_device *hdev, u64 addr, u64 siz
 				(u64 *)(lin_dma_pkts_arr), DEBUGFS_WRITE64);
 	WREG32(sob_addr, 0);
 
-	kfree(lin_dma_pkts_arr);
+	kvfree(lin_dma_pkts_arr);
 
 	return rc;
 }
-- 
2.46.0
Re: [RESEND PATCH] accel/habanalabs/gaudi2: Use kvfree() for memory allocated with kvcalloc()
Posted by Lukas Wunner 5 months, 3 weeks ago
On Wed, Aug 21, 2024 at 01:10:28AM +0200, Thorsten Blum wrote:
> Use kvfree() to fix the following Coccinelle/coccicheck warning reported
> by kfree_mismatch.cocci:
> 
>   WARNING kvmalloc is used to allocate this memory at line 10398
> 
> Reviewed-by: Tomer Tayar <ttayar@habana.ai>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

Applied to drm-misc-fixes, thanks.

You used toblux.com in the Signed-off-by tag but have since amended
.mailmap to use linux.dev instead.  To avoid a mismatch between the
Signed-off-by tag and the commit author, I've taken the liberty to
hand-edit the former to use linux.dev.

I've also added a Fixes tag and stable designation.

Qianfeng Rong later submitted an identical patch, so I've added a
Reported-by tag to acknowledge that:
https://patch.msgid.link/20250808085530.233737-1-rongqianfeng@vivo.com

Thanks,

Lukas