Use rte_calloc() where appropriate.
This makes the code clearer.
Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
drivers/net/ionic/ionic_ethdev.c | 6 +++---
drivers/net/ionic/ionic_lif.c | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
@@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
adapter->max_mac_addrs);
/* Allocate memory for storing MAC addresses */
- eth_dev->data->mac_addrs = rte_zmalloc("ionic",
- RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0);
-
+ eth_dev->data->mac_addrs = rte_calloc("ionic",
+ adapter->max_mac_addrs,
+ RTE_ETHER_ADDR_LEN, 0);
if (eth_dev->data->mac_addrs == NULL) {
IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
"store MAC addresses",
@@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif)
return -ENOMEM;
}
- lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) *
- adapter->max_ntxqs_per_lif, 0);
-
+ lif->txqcqs = rte_calloc("ionic",
+ adapter->max_ntxqs_per_lif,
+ sizeof(*lif->txqcqs), 0);
if (!lif->txqcqs) {
IONIC_PRINT(ERR, "Cannot allocate tx queues array");
return -ENOMEM;
}
- lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) *
- adapter->max_nrxqs_per_lif, 0);
-
+ lif->rxqcqs = rte_calloc("ionic",
+ adapter->max_nrxqs_per_lif,
+ sizeof(*lif->rxqcqs), 0);
if (!lif->rxqcqs) {
IONIC_PRINT(ERR, "Cannot allocate rx queues array");
return -ENOMEM;