public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: cavium: liquidio: Use vzalloc instead of vmalloc
@ 2016-06-18  6:53 Amitoj Kaur Chawla
  2016-06-22 20:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-06-18  6:53 UTC (permalink / raw)
  To: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
	netdev, linux-kernel
  Cc: julia.lawall

vzalloc combines vmalloc and memset 0.

The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            vmalloc
+            vzalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/net/ethernet/cavium/liquidio/octeon_device.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
index f67641a..2bf90c1 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -759,13 +759,10 @@ int octeon_setup_instr_queues(struct octeon_device *oct)
 
 	for (i = 0; i < num_iqs; i++) {
 		oct->instr_queue[i] =
-			vmalloc(sizeof(struct octeon_instr_queue));
+			vzalloc(sizeof(struct octeon_instr_queue));
 		if (!oct->instr_queue[i])
 			return 1;
 
-		memset(oct->instr_queue[i], 0,
-		       sizeof(struct octeon_instr_queue));
-
 		oct->instr_queue[i]->app_ctx = (void *)(size_t)i;
 		if (octeon_init_instr_queue(oct, i, num_descs))
 			return 1;
@@ -795,12 +792,10 @@ int octeon_setup_output_queues(struct octeon_device *oct)
 	oct->num_oqs = 0;
 
 	for (i = 0; i < num_oqs; i++) {
-		oct->droq[i] = vmalloc(sizeof(*oct->droq[i]));
+		oct->droq[i] = vzalloc(sizeof(*oct->droq[i]));
 		if (!oct->droq[i])
 			return 1;
 
-		memset(oct->droq[i], 0, sizeof(struct octeon_droq));
-
 		if (octeon_init_droq(oct, i, num_descs, desc_size, NULL))
 			return 1;
 
-- 
1.9.1

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

* Re: [PATCH] net: cavium: liquidio: Use vzalloc instead of vmalloc
  2016-06-18  6:53 [PATCH] net: cavium: liquidio: Use vzalloc instead of vmalloc Amitoj Kaur Chawla
@ 2016-06-22 20:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-06-22 20:20 UTC (permalink / raw)
  To: amitoj1606
  Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
	netdev, linux-kernel, julia.lawall

From: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Date: Sat, 18 Jun 2016 12:23:20 +0530

> vzalloc combines vmalloc and memset 0.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> type T;
> T *d;
> expression e;
> statement S;
> @@
> 
>         d =
> -            vmalloc
> +            vzalloc
>              (...);
>         if (!d) S
> -       memset(d, 0, sizeof(T));
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

This dos not apply cleanly to net-next.

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

end of thread, other threads:[~2016-06-22 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18  6:53 [PATCH] net: cavium: liquidio: Use vzalloc instead of vmalloc Amitoj Kaur Chawla
2016-06-22 20:20 ` David Miller

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