Skip to content

Commit 44364a0

Browse files
JoePerchesdavem330
authored andcommitted
s2io.c: use kzalloc
Signed-off-by: Joe Perches <[email protected]> Acked-by: Sreenivasa Honnur <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4f87032 commit 44364a0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/s2io.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,7 +3834,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
38343834
int size;
38353835

38363836
size = nic->num_entries * sizeof(struct msix_entry);
3837-
nic->entries = kmalloc(size, GFP_KERNEL);
3837+
nic->entries = kzalloc(size, GFP_KERNEL);
38383838
if (!nic->entries) {
38393839
DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \
38403840
__func__);
@@ -3843,10 +3843,8 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
38433843
}
38443844
nic->mac_control.stats_info->sw_stat.mem_allocated += size;
38453845

3846-
memset(nic->entries, 0, size);
3847-
38483846
size = nic->num_entries * sizeof(struct s2io_msix_entry);
3849-
nic->s2io_entries = kmalloc(size, GFP_KERNEL);
3847+
nic->s2io_entries = kzalloc(size, GFP_KERNEL);
38503848
if (!nic->s2io_entries) {
38513849
DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
38523850
__func__);
@@ -3857,7 +3855,6 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
38573855
return -ENOMEM;
38583856
}
38593857
nic->mac_control.stats_info->sw_stat.mem_allocated += size;
3860-
memset(nic->s2io_entries, 0, size);
38613858

38623859
nic->entries[0].entry = 0;
38633860
nic->s2io_entries[0].entry = 0;

0 commit comments

Comments
 (0)