mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] liquidio: Use zeroing memory allocator than allocator/memset
@ 2017-12-31 12:27 Himanshu Jha
  2018-01-03  3:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Himanshu Jha @ 2017-12-31 12:27 UTC (permalink / raw)
  To: derek.chickles
  Cc: satananda.burla, felix.manlunas, raghu.vatsavayi, netdev,
	linux-kernel, Himanshu Jha

Use vzalloc for allocating zeroed memory and remove unnecessary
memset function.

Done using Coccinelle.
Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
0-day tested with no failures.

Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/net/ethernet/cavium/liquidio/octeon_device.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
index 2c615ab..f38abf6 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -702,12 +702,10 @@ static struct octeon_device *octeon_allocate_device_mem(u32 pci_id,
 	size = octdevsize + priv_size + configsize +
 		(sizeof(struct octeon_dispatch) * DISPATCH_LIST_SIZE);
 
-	buf = vmalloc(size);
+	buf = vzalloc(size);
 	if (!buf)
 		return NULL;
 
-	memset(buf, 0, size);
-
 	oct = (struct octeon_device *)buf;
 	oct->priv = (void *)(buf + octdevsize);
 	oct->chip = (void *)(buf + octdevsize + priv_size);
@@ -840,10 +838,9 @@ octeon_allocate_ioq_vector(struct octeon_device  *oct)
 
 	size = sizeof(struct octeon_ioq_vector) * num_ioqs;
 
-	oct->ioq_vector = vmalloc(size);
+	oct->ioq_vector = vzalloc(size);
 	if (!oct->ioq_vector)
 		return 1;
-	memset(oct->ioq_vector, 0, size);
 	for (i = 0; i < num_ioqs; i++) {
 		ioq_vector		= &oct->ioq_vector[i];
 		ioq_vector->oct_dev	= oct;
-- 
2.7.4

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

* Re: [PATCH] liquidio: Use zeroing memory allocator than allocator/memset
  2017-12-31 12:27 [PATCH] liquidio: Use zeroing memory allocator than allocator/memset Himanshu Jha
@ 2018-01-03  3:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-03  3:01 UTC (permalink / raw)
  To: himanshujha199640
  Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
	netdev, linux-kernel

From: Himanshu Jha <himanshujha199640@gmail.com>
Date: Sun, 31 Dec 2017 17:57:29 +0530

> Use vzalloc for allocating zeroed memory and remove unnecessary
> memset function.
> 
> Done using Coccinelle.
> Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> 0-day tested with no failures.
> 
> Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

Applied to net-next.

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

end of thread, other threads:[~2018-01-03  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-31 12:27 [PATCH] liquidio: Use zeroing memory allocator than allocator/memset Himanshu Jha
2018-01-03  3:01 ` David Miller

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

all inboxes | Powered by JetHome®