linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc
       [not found] <cover.1551246708.git.bobbyeshleman@gmail.com>
@ 2019-02-27  6:09 ` Robert Eshleman
  2019-02-28  0:48   ` Robert Eshleman
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Eshleman @ 2019-02-27  6:09 UTC (permalink / raw)
  To: bobbyeshleman
  Cc: linux-rdma, netdev, Russell King, linux-kernel, David S. Miller,
	linux-arm-kernel, Tariq Toukan

This patch reduces a call to memset(,0) by replacing
a kmalloc call with a kzalloc call.

Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
---
 drivers/net/ethernet/seeq/ether3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/seeq/ether3.c b/drivers/net/ethernet/seeq/ether3.c
index d1bb73bf9914..7456cf08a48f 100644
--- a/drivers/net/ethernet/seeq/ether3.c
+++ b/drivers/net/ethernet/seeq/ether3.c
@@ -223,7 +223,7 @@ ether3_addr(char *addr, struct expansion_card *ec)
 static int
 ether3_ramtest(struct net_device *dev, unsigned char byte)
 {
-	unsigned char *buffer = kmalloc(RX_END, GFP_KERNEL);
+	unsigned char *buffer = kzalloc(RX_END, GFP_KERNEL);
 	int i,ret = 0;
 	int max_errors = 4;
 	int bad = -1;
@@ -231,7 +231,6 @@ ether3_ramtest(struct net_device *dev, unsigned char byte)
 	if (!buffer)
 		return 1;
 
-	memset(buffer, byte, RX_END);
 	ether3_setbuffer(dev, buffer_write, 0);
 	ether3_writebuffer(dev, buffer, TX_END);
 	ether3_setbuffer(dev, buffer_write, RX_START);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc
  2019-02-27  6:09 ` [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc Robert Eshleman
@ 2019-02-28  0:48   ` Robert Eshleman
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Eshleman @ 2019-02-28  0:48 UTC (permalink / raw)
  To: Robert Eshleman
  Cc: linux-rdma, netdev, Russell King, linux-kernel, David S. Miller,
	linux-arm-kernel, Tariq Toukan

On Tue, Feb 26, 2019 at 10:09:54PM -0800, Robert Eshleman wrote:
> This patch reduces a call to memset(,0) by replacing
> a kmalloc call with a kzalloc call.
> 
> Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
> ---
>  drivers/net/ethernet/seeq/ether3.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/seeq/ether3.c b/drivers/net/ethernet/seeq/ether3.c
> index d1bb73bf9914..7456cf08a48f 100644
> --- a/drivers/net/ethernet/seeq/ether3.c
> +++ b/drivers/net/ethernet/seeq/ether3.c
> @@ -223,7 +223,7 @@ ether3_addr(char *addr, struct expansion_card *ec)
>  static int
>  ether3_ramtest(struct net_device *dev, unsigned char byte)
>  {
> -	unsigned char *buffer = kmalloc(RX_END, GFP_KERNEL);
> +	unsigned char *buffer = kzalloc(RX_END, GFP_KERNEL);
>  	int i,ret = 0;
>  	int max_errors = 4;
>  	int bad = -1;
> @@ -231,7 +231,6 @@ ether3_ramtest(struct net_device *dev, unsigned char byte)
>  	if (!buffer)
>  		return 1;
>  
> -	memset(buffer, byte, RX_END);

Byte is not zero, so the intent of this patch does not apply here.
Dropping this from the patch set in v2.


>  	ether3_setbuffer(dev, buffer_write, 0);
>  	ether3_writebuffer(dev, buffer, TX_END);
>  	ether3_setbuffer(dev, buffer_write, RX_START);
> -- 
> 2.20.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-02-28  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1551246708.git.bobbyeshleman@gmail.com>
2019-02-27  6:09 ` [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc Robert Eshleman
2019-02-28  0:48   ` Robert Eshleman

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).