net/ring: use calloc style where appropriate
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 23 Apr 2019 16:53:34 +0000 (09:53 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 3 May 2019 16:45:23 +0000 (18:45 +0200)
Use rte_calloc_socket instead of computing size.

Fixes: 651c505af862 ("ring: enhance device setup from rings")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/ring/rte_eth_ring.c

index 2e4ca3b..0355f2b 100644 (file)
@@ -270,15 +270,15 @@ do_eth_dev_ring_create(const char *name,
        PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u",
                        numa_node);
 
-       rx_queues_local = rte_zmalloc_socket(name,
-                       sizeof(void *) * nb_rx_queues, 0, numa_node);
+       rx_queues_local = rte_calloc_socket(name, nb_rx_queues,
+                                           sizeof(void *), 0, numa_node);
        if (rx_queues_local == NULL) {
                rte_errno = ENOMEM;
                goto error;
        }
 
-       tx_queues_local = rte_zmalloc_socket(name,
-                       sizeof(void *) * nb_tx_queues, 0, numa_node);
+       tx_queues_local = rte_calloc_socket(name, nb_tx_queues,
+                                           sizeof(void *), 0, numa_node);
        if (tx_queues_local == NULL) {
                rte_errno = ENOMEM;
                goto error;