Commit 7fec4d39 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by David S. Miller

gve: Use kvcalloc() instead of kvzalloc()

Use 2-factor argument form kvcalloc() instead of kvzalloc().
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6a832a6c
...@@ -268,7 +268,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv) ...@@ -268,7 +268,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
int i, j; int i, j;
int err; int err;
priv->msix_vectors = kvzalloc(num_vecs_requested * priv->msix_vectors = kvcalloc(num_vecs_requested,
sizeof(*priv->msix_vectors), GFP_KERNEL); sizeof(*priv->msix_vectors), GFP_KERNEL);
if (!priv->msix_vectors) if (!priv->msix_vectors)
return -ENOMEM; return -ENOMEM;
...@@ -628,7 +628,7 @@ static int gve_alloc_rings(struct gve_priv *priv) ...@@ -628,7 +628,7 @@ static int gve_alloc_rings(struct gve_priv *priv)
int err; int err;
/* Setup tx rings */ /* Setup tx rings */
priv->tx = kvzalloc(priv->tx_cfg.num_queues * sizeof(*priv->tx), priv->tx = kvcalloc(priv->tx_cfg.num_queues, sizeof(*priv->tx),
GFP_KERNEL); GFP_KERNEL);
if (!priv->tx) if (!priv->tx)
return -ENOMEM; return -ENOMEM;
...@@ -641,7 +641,7 @@ static int gve_alloc_rings(struct gve_priv *priv) ...@@ -641,7 +641,7 @@ static int gve_alloc_rings(struct gve_priv *priv)
goto free_tx; goto free_tx;
/* Setup rx rings */ /* Setup rx rings */
priv->rx = kvzalloc(priv->rx_cfg.num_queues * sizeof(*priv->rx), priv->rx = kvcalloc(priv->rx_cfg.num_queues, sizeof(*priv->rx),
GFP_KERNEL); GFP_KERNEL);
if (!priv->rx) { if (!priv->rx) {
err = -ENOMEM; err = -ENOMEM;
...@@ -764,12 +764,11 @@ static int gve_alloc_queue_page_list(struct gve_priv *priv, u32 id, ...@@ -764,12 +764,11 @@ static int gve_alloc_queue_page_list(struct gve_priv *priv, u32 id,
qpl->id = id; qpl->id = id;
qpl->num_entries = 0; qpl->num_entries = 0;
qpl->pages = kvzalloc(pages * sizeof(*qpl->pages), GFP_KERNEL); qpl->pages = kvcalloc(pages, sizeof(*qpl->pages), GFP_KERNEL);
/* caller handles clean up */ /* caller handles clean up */
if (!qpl->pages) if (!qpl->pages)
return -ENOMEM; return -ENOMEM;
qpl->page_buses = kvzalloc(pages * sizeof(*qpl->page_buses), qpl->page_buses = kvcalloc(pages, sizeof(*qpl->page_buses), GFP_KERNEL);
GFP_KERNEL);
/* caller handles clean up */ /* caller handles clean up */
if (!qpl->page_buses) if (!qpl->page_buses)
return -ENOMEM; return -ENOMEM;
...@@ -828,7 +827,7 @@ static int gve_alloc_qpls(struct gve_priv *priv) ...@@ -828,7 +827,7 @@ static int gve_alloc_qpls(struct gve_priv *priv)
if (priv->queue_format == GVE_GQI_RDA_FORMAT) if (priv->queue_format == GVE_GQI_RDA_FORMAT)
return 0; return 0;
priv->qpls = kvzalloc(num_qpls * sizeof(*priv->qpls), GFP_KERNEL); priv->qpls = kvcalloc(num_qpls, sizeof(*priv->qpls), GFP_KERNEL);
if (!priv->qpls) if (!priv->qpls)
return -ENOMEM; return -ENOMEM;
...@@ -847,7 +846,7 @@ static int gve_alloc_qpls(struct gve_priv *priv) ...@@ -847,7 +846,7 @@ static int gve_alloc_qpls(struct gve_priv *priv)
priv->qpl_cfg.qpl_map_size = BITS_TO_LONGS(num_qpls) * priv->qpl_cfg.qpl_map_size = BITS_TO_LONGS(num_qpls) *
sizeof(unsigned long) * BITS_PER_BYTE; sizeof(unsigned long) * BITS_PER_BYTE;
priv->qpl_cfg.qpl_id_map = kvzalloc(BITS_TO_LONGS(num_qpls) * priv->qpl_cfg.qpl_id_map = kvcalloc(BITS_TO_LONGS(num_qpls),
sizeof(unsigned long), GFP_KERNEL); sizeof(unsigned long), GFP_KERNEL);
if (!priv->qpl_cfg.qpl_id_map) { if (!priv->qpl_cfg.qpl_id_map) {
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment