Skip to content

Commit 72bca20

Browse files
himanshujha199640davem330
authored andcommitted
liquidio: Use zeroing memory allocator than allocator/memset
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aa006d1 commit 72bca20

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/ethernet/cavium/liquidio/octeon_device.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,10 @@ static struct octeon_device *octeon_allocate_device_mem(u32 pci_id,
702702
size = octdevsize + priv_size + configsize +
703703
(sizeof(struct octeon_dispatch) * DISPATCH_LIST_SIZE);
704704

705-
buf = vmalloc(size);
705+
buf = vzalloc(size);
706706
if (!buf)
707707
return NULL;
708708

709-
memset(buf, 0, size);
710-
711709
oct = (struct octeon_device *)buf;
712710
oct->priv = (void *)(buf + octdevsize);
713711
oct->chip = (void *)(buf + octdevsize + priv_size);
@@ -840,10 +838,9 @@ octeon_allocate_ioq_vector(struct octeon_device *oct)
840838

841839
size = sizeof(struct octeon_ioq_vector) * num_ioqs;
842840

843-
oct->ioq_vector = vmalloc(size);
841+
oct->ioq_vector = vzalloc(size);
844842
if (!oct->ioq_vector)
845843
return 1;
846-
memset(oct->ioq_vector, 0, size);
847844
for (i = 0; i < num_ioqs; i++) {
848845
ioq_vector = &oct->ioq_vector[i];
849846
ioq_vector->oct_dev = oct;

0 commit comments

Comments
 (0)