* [PATCH] net: alteon: Avoid some useless memset
@ 2020-07-16 20:52 Christophe JAILLET
2020-07-17 19:58 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-07-16 20:52 UTC (permalink / raw)
To: davem, kuba, jes
Cc: linux-acenic, netdev, linux-kernel, kernel-janitors, Christophe JAILLET
Avoid a memset after a call to 'dma_alloc_coherent()'.
This is useless since
commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*")
Replace a kmalloc+memset with a corresponding kzalloc.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/alteon/acenic.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c
index 99431c9a899b..ac86fcae1582 100644
--- a/drivers/net/ethernet/alteon/acenic.c
+++ b/drivers/net/ethernet/alteon/acenic.c
@@ -1151,7 +1151,7 @@ static int ace_init(struct net_device *dev)
/*
* Get the memory for the skb rings.
*/
- if (!(ap->skb = kmalloc(sizeof(struct ace_skb), GFP_KERNEL))) {
+ if (!(ap->skb = kzalloc(sizeof(struct ace_skb), GFP_KERNEL))) {
ecode = -EAGAIN;
goto init_error;
}
@@ -1172,9 +1172,6 @@ static int ace_init(struct net_device *dev)
ap->last_mini_rx = 0;
#endif
- memset(ap->info, 0, sizeof(struct ace_info));
- memset(ap->skb, 0, sizeof(struct ace_skb));
-
ecode = ace_load_firmware(dev);
if (ecode)
goto init_error;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: alteon: Avoid some useless memset
2020-07-16 20:52 [PATCH] net: alteon: Avoid some useless memset Christophe JAILLET
@ 2020-07-17 19:58 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-17 19:58 UTC (permalink / raw)
To: christophe.jaillet
Cc: kuba, jes, linux-acenic, netdev, linux-kernel, kernel-janitors
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Thu, 16 Jul 2020 22:52:42 +0200
> Avoid a memset after a call to 'dma_alloc_coherent()'.
> This is useless since
> commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*")
>
> Replace a kmalloc+memset with a corresponding kzalloc.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-17 19:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 20:52 [PATCH] net: alteon: Avoid some useless memset Christophe JAILLET
2020-07-17 19:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).