diff options
author | Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com> | 2015-06-05 06:03:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-07 18:35:11 -0400 |
commit | e51000db4c880165eab06ec0990605f24e75203f (patch) | |
tree | 09ef9f59b2984e5378ba5b95a4a1fffda3bf05e4 /drivers/net | |
parent | 1d7c49037b12016e7056b9f2c990380e2187e766 (diff) |
be2net: Replace dma/pci_alloc_coherent() calls with dma_zalloc_coherent()
There are several places in the driver (all in control paths) where
coherent dma memory is being allocated using either dma_alloc_coherent()
or the deprecated pci_alloc_consistent(). All these calls should be
changed to use dma_zalloc_coherent() to avoid uninitialized fields in
data structures backed by this memory.
Reported-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 87 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_ethtool.c | 18 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 15 |
3 files changed, 67 insertions, 53 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index fb140faeafb1..c5e1d0ac75f9 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -1720,9 +1720,9 @@ int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | |||
1720 | total_size = buf_len; | 1720 | total_size = buf_len; |
1721 | 1721 | ||
1722 | get_fat_cmd.size = sizeof(struct be_cmd_req_get_fat) + 60*1024; | 1722 | get_fat_cmd.size = sizeof(struct be_cmd_req_get_fat) + 60*1024; |
1723 | get_fat_cmd.va = pci_alloc_consistent(adapter->pdev, | 1723 | get_fat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
1724 | get_fat_cmd.size, | 1724 | get_fat_cmd.size, |
1725 | &get_fat_cmd.dma); | 1725 | &get_fat_cmd.dma, GFP_ATOMIC); |
1726 | if (!get_fat_cmd.va) { | 1726 | if (!get_fat_cmd.va) { |
1727 | dev_err(&adapter->pdev->dev, | 1727 | dev_err(&adapter->pdev->dev, |
1728 | "Memory allocation failure while reading FAT data\n"); | 1728 | "Memory allocation failure while reading FAT data\n"); |
@@ -1767,8 +1767,8 @@ int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | |||
1767 | log_offset += buf_size; | 1767 | log_offset += buf_size; |
1768 | } | 1768 | } |
1769 | err: | 1769 | err: |
1770 | pci_free_consistent(adapter->pdev, get_fat_cmd.size, | 1770 | dma_free_coherent(&adapter->pdev->dev, get_fat_cmd.size, |
1771 | get_fat_cmd.va, get_fat_cmd.dma); | 1771 | get_fat_cmd.va, get_fat_cmd.dma); |
1772 | spin_unlock_bh(&adapter->mcc_lock); | 1772 | spin_unlock_bh(&adapter->mcc_lock); |
1773 | return status; | 1773 | return status; |
1774 | } | 1774 | } |
@@ -2215,12 +2215,12 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, | |||
2215 | return -EINVAL; | 2215 | return -EINVAL; |
2216 | 2216 | ||
2217 | cmd.size = sizeof(struct be_cmd_resp_port_type); | 2217 | cmd.size = sizeof(struct be_cmd_resp_port_type); |
2218 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 2218 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
2219 | GFP_ATOMIC); | ||
2219 | if (!cmd.va) { | 2220 | if (!cmd.va) { |
2220 | dev_err(&adapter->pdev->dev, "Memory allocation failed\n"); | 2221 | dev_err(&adapter->pdev->dev, "Memory allocation failed\n"); |
2221 | return -ENOMEM; | 2222 | return -ENOMEM; |
2222 | } | 2223 | } |
2223 | memset(cmd.va, 0, cmd.size); | ||
2224 | 2224 | ||
2225 | spin_lock_bh(&adapter->mcc_lock); | 2225 | spin_lock_bh(&adapter->mcc_lock); |
2226 | 2226 | ||
@@ -2245,7 +2245,7 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, | |||
2245 | } | 2245 | } |
2246 | err: | 2246 | err: |
2247 | spin_unlock_bh(&adapter->mcc_lock); | 2247 | spin_unlock_bh(&adapter->mcc_lock); |
2248 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 2248 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); |
2249 | return status; | 2249 | return status; |
2250 | } | 2250 | } |
2251 | 2251 | ||
@@ -2720,7 +2720,8 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) | |||
2720 | goto err; | 2720 | goto err; |
2721 | } | 2721 | } |
2722 | cmd.size = sizeof(struct be_cmd_req_get_phy_info); | 2722 | cmd.size = sizeof(struct be_cmd_req_get_phy_info); |
2723 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 2723 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
2724 | GFP_ATOMIC); | ||
2724 | if (!cmd.va) { | 2725 | if (!cmd.va) { |
2725 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); | 2726 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); |
2726 | status = -ENOMEM; | 2727 | status = -ENOMEM; |
@@ -2754,7 +2755,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) | |||
2754 | BE_SUPPORTED_SPEED_1GBPS; | 2755 | BE_SUPPORTED_SPEED_1GBPS; |
2755 | } | 2756 | } |
2756 | } | 2757 | } |
2757 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 2758 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); |
2758 | err: | 2759 | err: |
2759 | spin_unlock_bh(&adapter->mcc_lock); | 2760 | spin_unlock_bh(&adapter->mcc_lock); |
2760 | return status; | 2761 | return status; |
@@ -2805,8 +2806,9 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) | |||
2805 | 2806 | ||
2806 | memset(&attribs_cmd, 0, sizeof(struct be_dma_mem)); | 2807 | memset(&attribs_cmd, 0, sizeof(struct be_dma_mem)); |
2807 | attribs_cmd.size = sizeof(struct be_cmd_resp_cntl_attribs); | 2808 | attribs_cmd.size = sizeof(struct be_cmd_resp_cntl_attribs); |
2808 | attribs_cmd.va = pci_alloc_consistent(adapter->pdev, attribs_cmd.size, | 2809 | attribs_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
2809 | &attribs_cmd.dma); | 2810 | attribs_cmd.size, |
2811 | &attribs_cmd.dma, GFP_ATOMIC); | ||
2810 | if (!attribs_cmd.va) { | 2812 | if (!attribs_cmd.va) { |
2811 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); | 2813 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); |
2812 | status = -ENOMEM; | 2814 | status = -ENOMEM; |
@@ -2833,8 +2835,8 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) | |||
2833 | err: | 2835 | err: |
2834 | mutex_unlock(&adapter->mbox_lock); | 2836 | mutex_unlock(&adapter->mbox_lock); |
2835 | if (attribs_cmd.va) | 2837 | if (attribs_cmd.va) |
2836 | pci_free_consistent(adapter->pdev, attribs_cmd.size, | 2838 | dma_free_coherent(&adapter->pdev->dev, attribs_cmd.size, |
2837 | attribs_cmd.va, attribs_cmd.dma); | 2839 | attribs_cmd.va, attribs_cmd.dma); |
2838 | return status; | 2840 | return status; |
2839 | } | 2841 | } |
2840 | 2842 | ||
@@ -2972,9 +2974,10 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, | |||
2972 | 2974 | ||
2973 | memset(&get_mac_list_cmd, 0, sizeof(struct be_dma_mem)); | 2975 | memset(&get_mac_list_cmd, 0, sizeof(struct be_dma_mem)); |
2974 | get_mac_list_cmd.size = sizeof(struct be_cmd_resp_get_mac_list); | 2976 | get_mac_list_cmd.size = sizeof(struct be_cmd_resp_get_mac_list); |
2975 | get_mac_list_cmd.va = pci_alloc_consistent(adapter->pdev, | 2977 | get_mac_list_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
2976 | get_mac_list_cmd.size, | 2978 | get_mac_list_cmd.size, |
2977 | &get_mac_list_cmd.dma); | 2979 | &get_mac_list_cmd.dma, |
2980 | GFP_ATOMIC); | ||
2978 | 2981 | ||
2979 | if (!get_mac_list_cmd.va) { | 2982 | if (!get_mac_list_cmd.va) { |
2980 | dev_err(&adapter->pdev->dev, | 2983 | dev_err(&adapter->pdev->dev, |
@@ -3047,8 +3050,8 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, | |||
3047 | 3050 | ||
3048 | out: | 3051 | out: |
3049 | spin_unlock_bh(&adapter->mcc_lock); | 3052 | spin_unlock_bh(&adapter->mcc_lock); |
3050 | pci_free_consistent(adapter->pdev, get_mac_list_cmd.size, | 3053 | dma_free_coherent(&adapter->pdev->dev, get_mac_list_cmd.size, |
3051 | get_mac_list_cmd.va, get_mac_list_cmd.dma); | 3054 | get_mac_list_cmd.va, get_mac_list_cmd.dma); |
3052 | return status; | 3055 | return status; |
3053 | } | 3056 | } |
3054 | 3057 | ||
@@ -3101,8 +3104,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, | |||
3101 | 3104 | ||
3102 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | 3105 | memset(&cmd, 0, sizeof(struct be_dma_mem)); |
3103 | cmd.size = sizeof(struct be_cmd_req_set_mac_list); | 3106 | cmd.size = sizeof(struct be_cmd_req_set_mac_list); |
3104 | cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, | 3107 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
3105 | &cmd.dma, GFP_KERNEL); | 3108 | GFP_KERNEL); |
3106 | if (!cmd.va) | 3109 | if (!cmd.va) |
3107 | return -ENOMEM; | 3110 | return -ENOMEM; |
3108 | 3111 | ||
@@ -3291,7 +3294,8 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) | |||
3291 | 3294 | ||
3292 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | 3295 | memset(&cmd, 0, sizeof(struct be_dma_mem)); |
3293 | cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1); | 3296 | cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1); |
3294 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 3297 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
3298 | GFP_ATOMIC); | ||
3295 | if (!cmd.va) { | 3299 | if (!cmd.va) { |
3296 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); | 3300 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); |
3297 | status = -ENOMEM; | 3301 | status = -ENOMEM; |
@@ -3326,7 +3330,8 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) | |||
3326 | err: | 3330 | err: |
3327 | mutex_unlock(&adapter->mbox_lock); | 3331 | mutex_unlock(&adapter->mbox_lock); |
3328 | if (cmd.va) | 3332 | if (cmd.va) |
3329 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 3333 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, |
3334 | cmd.dma); | ||
3330 | return status; | 3335 | return status; |
3331 | 3336 | ||
3332 | } | 3337 | } |
@@ -3340,8 +3345,9 @@ int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level) | |||
3340 | 3345 | ||
3341 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); | 3346 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); |
3342 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); | 3347 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); |
3343 | extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size, | 3348 | extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
3344 | &extfat_cmd.dma); | 3349 | extfat_cmd.size, &extfat_cmd.dma, |
3350 | GFP_ATOMIC); | ||
3345 | if (!extfat_cmd.va) | 3351 | if (!extfat_cmd.va) |
3346 | return -ENOMEM; | 3352 | return -ENOMEM; |
3347 | 3353 | ||
@@ -3363,8 +3369,8 @@ int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level) | |||
3363 | 3369 | ||
3364 | status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd, cfgs); | 3370 | status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd, cfgs); |
3365 | err: | 3371 | err: |
3366 | pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va, | 3372 | dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, |
3367 | extfat_cmd.dma); | 3373 | extfat_cmd.dma); |
3368 | return status; | 3374 | return status; |
3369 | } | 3375 | } |
3370 | 3376 | ||
@@ -3377,8 +3383,9 @@ int be_cmd_get_fw_log_level(struct be_adapter *adapter) | |||
3377 | 3383 | ||
3378 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); | 3384 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); |
3379 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); | 3385 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); |
3380 | extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size, | 3386 | extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
3381 | &extfat_cmd.dma); | 3387 | extfat_cmd.size, &extfat_cmd.dma, |
3388 | GFP_ATOMIC); | ||
3382 | 3389 | ||
3383 | if (!extfat_cmd.va) { | 3390 | if (!extfat_cmd.va) { |
3384 | dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n", | 3391 | dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n", |
@@ -3396,8 +3403,8 @@ int be_cmd_get_fw_log_level(struct be_adapter *adapter) | |||
3396 | level = cfgs->module[0].trace_lvl[j].dbg_lvl; | 3403 | level = cfgs->module[0].trace_lvl[j].dbg_lvl; |
3397 | } | 3404 | } |
3398 | } | 3405 | } |
3399 | pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va, | 3406 | dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, |
3400 | extfat_cmd.dma); | 3407 | extfat_cmd.dma); |
3401 | err: | 3408 | err: |
3402 | return level; | 3409 | return level; |
3403 | } | 3410 | } |
@@ -3595,7 +3602,8 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res) | |||
3595 | 3602 | ||
3596 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | 3603 | memset(&cmd, 0, sizeof(struct be_dma_mem)); |
3597 | cmd.size = sizeof(struct be_cmd_resp_get_func_config); | 3604 | cmd.size = sizeof(struct be_cmd_resp_get_func_config); |
3598 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 3605 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
3606 | GFP_ATOMIC); | ||
3599 | if (!cmd.va) { | 3607 | if (!cmd.va) { |
3600 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); | 3608 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); |
3601 | status = -ENOMEM; | 3609 | status = -ENOMEM; |
@@ -3635,7 +3643,8 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res) | |||
3635 | err: | 3643 | err: |
3636 | mutex_unlock(&adapter->mbox_lock); | 3644 | mutex_unlock(&adapter->mbox_lock); |
3637 | if (cmd.va) | 3645 | if (cmd.va) |
3638 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 3646 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, |
3647 | cmd.dma); | ||
3639 | return status; | 3648 | return status; |
3640 | } | 3649 | } |
3641 | 3650 | ||
@@ -3656,7 +3665,8 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, | |||
3656 | 3665 | ||
3657 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | 3666 | memset(&cmd, 0, sizeof(struct be_dma_mem)); |
3658 | cmd.size = sizeof(struct be_cmd_resp_get_profile_config); | 3667 | cmd.size = sizeof(struct be_cmd_resp_get_profile_config); |
3659 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 3668 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
3669 | GFP_ATOMIC); | ||
3660 | if (!cmd.va) | 3670 | if (!cmd.va) |
3661 | return -ENOMEM; | 3671 | return -ENOMEM; |
3662 | 3672 | ||
@@ -3702,7 +3712,8 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, | |||
3702 | res->vf_if_cap_flags = vf_res->cap_flags; | 3712 | res->vf_if_cap_flags = vf_res->cap_flags; |
3703 | err: | 3713 | err: |
3704 | if (cmd.va) | 3714 | if (cmd.va) |
3705 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 3715 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, |
3716 | cmd.dma); | ||
3706 | return status; | 3717 | return status; |
3707 | } | 3718 | } |
3708 | 3719 | ||
@@ -3717,7 +3728,8 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc, | |||
3717 | 3728 | ||
3718 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | 3729 | memset(&cmd, 0, sizeof(struct be_dma_mem)); |
3719 | cmd.size = sizeof(struct be_cmd_req_set_profile_config); | 3730 | cmd.size = sizeof(struct be_cmd_req_set_profile_config); |
3720 | cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | 3731 | cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
3732 | GFP_ATOMIC); | ||
3721 | if (!cmd.va) | 3733 | if (!cmd.va) |
3722 | return -ENOMEM; | 3734 | return -ENOMEM; |
3723 | 3735 | ||
@@ -3733,7 +3745,8 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc, | |||
3733 | status = be_cmd_notify_wait(adapter, &wrb); | 3745 | status = be_cmd_notify_wait(adapter, &wrb); |
3734 | 3746 | ||
3735 | if (cmd.va) | 3747 | if (cmd.va) |
3736 | pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | 3748 | dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, |
3749 | cmd.dma); | ||
3737 | return status; | 3750 | return status; |
3738 | } | 3751 | } |
3739 | 3752 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index b765c24625bf..2835dee5dc39 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -264,8 +264,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, | |||
264 | int status = 0; | 264 | int status = 0; |
265 | 265 | ||
266 | read_cmd.size = LANCER_READ_FILE_CHUNK; | 266 | read_cmd.size = LANCER_READ_FILE_CHUNK; |
267 | read_cmd.va = pci_alloc_consistent(adapter->pdev, read_cmd.size, | 267 | read_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, read_cmd.size, |
268 | &read_cmd.dma); | 268 | &read_cmd.dma, GFP_ATOMIC); |
269 | 269 | ||
270 | if (!read_cmd.va) { | 270 | if (!read_cmd.va) { |
271 | dev_err(&adapter->pdev->dev, | 271 | dev_err(&adapter->pdev->dev, |
@@ -289,8 +289,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, | |||
289 | break; | 289 | break; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | pci_free_consistent(adapter->pdev, read_cmd.size, read_cmd.va, | 292 | dma_free_coherent(&adapter->pdev->dev, read_cmd.size, read_cmd.va, |
293 | read_cmd.dma); | 293 | read_cmd.dma); |
294 | 294 | ||
295 | return status; | 295 | return status; |
296 | } | 296 | } |
@@ -818,8 +818,9 @@ static int be_test_ddr_dma(struct be_adapter *adapter) | |||
818 | }; | 818 | }; |
819 | 819 | ||
820 | ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test); | 820 | ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test); |
821 | ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, ddrdma_cmd.size, | 821 | ddrdma_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
822 | &ddrdma_cmd.dma, GFP_KERNEL); | 822 | ddrdma_cmd.size, &ddrdma_cmd.dma, |
823 | GFP_KERNEL); | ||
823 | if (!ddrdma_cmd.va) | 824 | if (!ddrdma_cmd.va) |
824 | return -ENOMEM; | 825 | return -ENOMEM; |
825 | 826 | ||
@@ -941,8 +942,9 @@ static int be_read_eeprom(struct net_device *netdev, | |||
941 | 942 | ||
942 | memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem)); | 943 | memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem)); |
943 | eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read); | 944 | eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read); |
944 | eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, eeprom_cmd.size, | 945 | eeprom_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
945 | &eeprom_cmd.dma, GFP_KERNEL); | 946 | eeprom_cmd.size, &eeprom_cmd.dma, |
947 | GFP_KERNEL); | ||
946 | 948 | ||
947 | if (!eeprom_cmd.va) | 949 | if (!eeprom_cmd.va) |
948 | return -ENOMEM; | 950 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6f9ffb9026cd..e43cc8a73ea7 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4605,8 +4605,8 @@ static int lancer_fw_download(struct be_adapter *adapter, | |||
4605 | 4605 | ||
4606 | flash_cmd.size = sizeof(struct lancer_cmd_req_write_object) | 4606 | flash_cmd.size = sizeof(struct lancer_cmd_req_write_object) |
4607 | + LANCER_FW_DOWNLOAD_CHUNK; | 4607 | + LANCER_FW_DOWNLOAD_CHUNK; |
4608 | flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, | 4608 | flash_cmd.va = dma_zalloc_coherent(dev, flash_cmd.size, |
4609 | &flash_cmd.dma, GFP_KERNEL); | 4609 | &flash_cmd.dma, GFP_KERNEL); |
4610 | if (!flash_cmd.va) | 4610 | if (!flash_cmd.va) |
4611 | return -ENOMEM; | 4611 | return -ENOMEM; |
4612 | 4612 | ||
@@ -4739,8 +4739,8 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) | |||
4739 | } | 4739 | } |
4740 | 4740 | ||
4741 | flash_cmd.size = sizeof(struct be_cmd_write_flashrom); | 4741 | flash_cmd.size = sizeof(struct be_cmd_write_flashrom); |
4742 | flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, &flash_cmd.dma, | 4742 | flash_cmd.va = dma_zalloc_coherent(dev, flash_cmd.size, &flash_cmd.dma, |
4743 | GFP_KERNEL); | 4743 | GFP_KERNEL); |
4744 | if (!flash_cmd.va) | 4744 | if (!flash_cmd.va) |
4745 | return -ENOMEM; | 4745 | return -ENOMEM; |
4746 | 4746 | ||
@@ -5291,16 +5291,15 @@ static int be_drv_init(struct be_adapter *adapter) | |||
5291 | int status = 0; | 5291 | int status = 0; |
5292 | 5292 | ||
5293 | mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16; | 5293 | mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16; |
5294 | mbox_mem_alloc->va = dma_alloc_coherent(dev, mbox_mem_alloc->size, | 5294 | mbox_mem_alloc->va = dma_zalloc_coherent(dev, mbox_mem_alloc->size, |
5295 | &mbox_mem_alloc->dma, | 5295 | &mbox_mem_alloc->dma, |
5296 | GFP_KERNEL); | 5296 | GFP_KERNEL); |
5297 | if (!mbox_mem_alloc->va) | 5297 | if (!mbox_mem_alloc->va) |
5298 | return -ENOMEM; | 5298 | return -ENOMEM; |
5299 | 5299 | ||
5300 | mbox_mem_align->size = sizeof(struct be_mcc_mailbox); | 5300 | mbox_mem_align->size = sizeof(struct be_mcc_mailbox); |
5301 | mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16); | 5301 | mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16); |
5302 | mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16); | 5302 | mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16); |
5303 | memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox)); | ||
5304 | 5303 | ||
5305 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); | 5304 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); |
5306 | rx_filter->va = dma_zalloc_coherent(dev, rx_filter->size, | 5305 | rx_filter->va = dma_zalloc_coherent(dev, rx_filter->size, |