aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 7f6b0e611e3b..75102fb69519 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -561,7 +561,7 @@ static int init_shared_mem(struct s2io_nic *nic)
561 for (i = 0; i < config->tx_fifo_num; i++) { 561 for (i = 0; i < config->tx_fifo_num; i++) {
562 int fifo_len = config->tx_cfg[i].fifo_len; 562 int fifo_len = config->tx_cfg[i].fifo_len;
563 int list_holder_size = fifo_len * sizeof(struct list_info_hold); 563 int list_holder_size = fifo_len * sizeof(struct list_info_hold);
564 mac_control->fifos[i].list_info = kmalloc(list_holder_size, 564 mac_control->fifos[i].list_info = kzalloc(list_holder_size,
565 GFP_KERNEL); 565 GFP_KERNEL);
566 if (!mac_control->fifos[i].list_info) { 566 if (!mac_control->fifos[i].list_info) {
567 DBG_PRINT(INFO_DBG, 567 DBG_PRINT(INFO_DBG,
@@ -569,7 +569,6 @@ static int init_shared_mem(struct s2io_nic *nic)
569 return -ENOMEM; 569 return -ENOMEM;
570 } 570 }
571 mem_allocated += list_holder_size; 571 mem_allocated += list_holder_size;
572 memset(mac_control->fifos[i].list_info, 0, list_holder_size);
573 } 572 }
574 for (i = 0; i < config->tx_fifo_num; i++) { 573 for (i = 0; i < config->tx_fifo_num; i++) {
575 int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len, 574 int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
@@ -3661,9 +3660,9 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3661 u16 msi_control; /* Temp variable */ 3660 u16 msi_control; /* Temp variable */
3662 int ret, i, j, msix_indx = 1; 3661 int ret, i, j, msix_indx = 1;
3663 3662
3664 nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry), 3663 nic->entries = kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct msix_entry),
3665 GFP_KERNEL); 3664 GFP_KERNEL);
3666 if (nic->entries == NULL) { 3665 if (!nic->entries) {
3667 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \ 3666 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \
3668 __FUNCTION__); 3667 __FUNCTION__);
3669 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3668 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3671,12 +3670,11 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3671 } 3670 }
3672 nic->mac_control.stats_info->sw_stat.mem_allocated 3671 nic->mac_control.stats_info->sw_stat.mem_allocated
3673 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3672 += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
3674 memset(nic->entries, 0,MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
3675 3673
3676 nic->s2io_entries = 3674 nic->s2io_entries =
3677 kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry), 3675 kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct s2io_msix_entry),
3678 GFP_KERNEL); 3676 GFP_KERNEL);
3679 if (nic->s2io_entries == NULL) { 3677 if (!nic->s2io_entries) {
3680 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", 3678 DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
3681 __FUNCTION__); 3679 __FUNCTION__);
3682 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3680 nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3687,8 +3685,6 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3687 } 3685 }
3688 nic->mac_control.stats_info->sw_stat.mem_allocated 3686 nic->mac_control.stats_info->sw_stat.mem_allocated
3689 += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3687 += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
3690 memset(nic->s2io_entries, 0,
3691 MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
3692 3688
3693 for (i=0; i< MAX_REQUESTED_MSI_X; i++) { 3689 for (i=0; i< MAX_REQUESTED_MSI_X; i++) {
3694 nic->entries[i].entry = i; 3690 nic->entries[i].entry = i;