[net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call

Message ID d5acce7dd108887832c9719f62c7201b4c83b3fb.1676184599.git.christophe.jaillet@wanadoo.fr
State New
Headers
Series [net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call |

Commit Message

Christophe JAILLET Feb. 12, 2023, 6:51 a.m. UTC
  dma_alloc_coherent() already clears the allocated memory, there is no need
to explicitly call memset().

Moreover, it is likely that the size in the memset() is incorrect and
should be "size * sizeof(*ring->desc)".

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/mediatek/mtk_wed.c | 1 -
 1 file changed, 1 deletion(-)
  

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 14, 2023, 3:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sun, 12 Feb 2023 07:51:51 +0100 you wrote:
> dma_alloc_coherent() already clears the allocated memory, there is no need
> to explicitly call memset().
> 
> Moreover, it is likely that the size in the memset() is incorrect and
> should be "size * sizeof(*ring->desc)".
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> [...]

Here is the summary with links:
  - [net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call
    https://git.kernel.org/netdev/net-next/c/511b88fedab4

You are awesome, thank you!
  

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 95ac4f71d2b2..95d890870984 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -787,7 +787,6 @@  mtk_wed_rro_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring,
 
 	ring->desc_size = sizeof(*ring->desc);
 	ring->size = size;
-	memset(ring->desc, 0, size);
 
 	return 0;
 }