net/qede/base: change valloc to vzalloc
authorRasesh Mody <rasesh.mody@cavium.com>
Wed, 29 Mar 2017 20:36:40 +0000 (13:36 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:53 +0000 (19:02 +0200)
Change OSAL_VALLOC() into OSAL_VZALLOC() which would also zero memory.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/bcm_osal.h
drivers/net/qede/base/ecore_dev.c
drivers/net/qede/base/ecore_l2.c
drivers/net/qede/base/ecore_mng_tlv.c
drivers/net/qede/base/ecore_sriov.c

index 4c91dc0..052a0cf 100644 (file)
@@ -89,7 +89,7 @@ typedef int bool;
 #define OSAL_ALLOC(dev, GFP, size) rte_malloc("qede", size, 0)
 #define OSAL_ZALLOC(dev, GFP, size) rte_zmalloc("qede", size, 0)
 #define OSAL_CALLOC(dev, GFP, num, size) rte_calloc("qede", num, size, 0)
-#define OSAL_VALLOC(dev, size) rte_malloc("qede", size, 0)
+#define OSAL_VZALLOC(dev, size) rte_zmalloc("qede", size, 0)
 #define OSAL_FREE(dev, memory)           \
        do {                              \
                rte_free((void *)memory); \
index 0840d49..6d75e60 100644 (file)
@@ -3717,13 +3717,12 @@ ecore_chain_alloc_pbl(struct ecore_dev *p_dev,
        u32 page_cnt = p_chain->page_cnt, size, i;
 
        size = page_cnt * sizeof(*pp_virt_addr_tbl);
-       pp_virt_addr_tbl = (void **)OSAL_VALLOC(p_dev, size);
+       pp_virt_addr_tbl = (void **)OSAL_VZALLOC(p_dev, size);
        if (!pp_virt_addr_tbl) {
                DP_NOTICE(p_dev, true,
                          "Failed to allocate memory for the chain virtual addresses table\n");
                return ECORE_NOMEM;
        }
-       OSAL_MEM_ZERO(pp_virt_addr_tbl, size);
 
        /* The allocation of the PBL table is done with its full size, since it
         * is expected to be successive.
index 2635213..4d26e19 100644 (file)
@@ -50,10 +50,9 @@ _ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn,
        struct ecore_queue_cid *p_cid;
        enum _ecore_status_t rc;
 
-       p_cid = OSAL_VALLOC(p_hwfn->p_dev, sizeof(*p_cid));
+       p_cid = OSAL_VZALLOC(p_hwfn->p_dev, sizeof(*p_cid));
        if (p_cid == OSAL_NULL)
                return OSAL_NULL;
-       OSAL_MEM_ZERO(p_cid, sizeof(*p_cid));
 
        p_cid->opaque_fid = opaque_fid;
        p_cid->cid = cid;
index 0065d12..0bf1be8 100644 (file)
@@ -1413,11 +1413,10 @@ ecore_mfw_update_tlvs(u8 tlv_group, struct ecore_hwfn *p_hwfn,
        u32 offset;
        int len;
 
-       p_tlv_data = OSAL_VALLOC(p_hwfn->p_dev, sizeof(*p_tlv_data));
+       p_tlv_data = OSAL_VZALLOC(p_hwfn->p_dev, sizeof(*p_tlv_data));
        if (!p_tlv_data)
                return ECORE_NOMEM;
 
-       OSAL_MEMSET(p_tlv_data, 0, sizeof(*p_tlv_data));
        if (OSAL_MFW_FILL_TLV_DATA(p_hwfn, tlv_group, p_tlv_data)) {
                OSAL_VFREE(p_hwfn->p_dev, p_tlv_data);
                return ECORE_INVAL;
@@ -1487,7 +1486,7 @@ ecore_mfw_process_tlv_req(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt)
                goto drv_done;
        }
 
-       p_mfw_buf = (void *)OSAL_VALLOC(p_hwfn->p_dev, size);
+       p_mfw_buf = (void *)OSAL_VZALLOC(p_hwfn->p_dev, size);
        if (!p_mfw_buf) {
                DP_NOTICE(p_hwfn, false,
                          "Failed allocate memory for p_mfw_buf\n");
index 280c992..aab9925 100644 (file)
@@ -2845,7 +2845,7 @@ static void ecore_iov_vf_mbx_vport_update(struct ecore_hwfn *p_hwfn,
                goto out;
        }
 
-       p_rss_params = OSAL_VALLOC(p_hwfn->p_dev, sizeof(*p_rss_params));
+       p_rss_params = OSAL_VZALLOC(p_hwfn->p_dev, sizeof(*p_rss_params));
        if (p_rss_params == OSAL_NULL) {
                status = PFVF_STATUS_FAILURE;
                goto out;