Commit 0d404a61 authored by Ilias Apalodimas's avatar Ilias Apalodimas Committed by David S. Miller

net: socionext: refactor netsec_alloc_dring()

return -ENOMEM directly instead of assigning it in a variable
Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4acb20b4
...@@ -996,26 +996,21 @@ static void netsec_free_dring(struct netsec_priv *priv, int id) ...@@ -996,26 +996,21 @@ static void netsec_free_dring(struct netsec_priv *priv, int id)
static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id) static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
{ {
struct netsec_desc_ring *dring = &priv->desc_ring[id]; struct netsec_desc_ring *dring = &priv->desc_ring[id];
int ret = 0;
dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM, dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
&dring->desc_dma, GFP_KERNEL); &dring->desc_dma, GFP_KERNEL);
if (!dring->vaddr) { if (!dring->vaddr)
ret = -ENOMEM;
goto err; goto err;
}
dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL); dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL);
if (!dring->desc) { if (!dring->desc)
ret = -ENOMEM;
goto err; goto err;
}
return 0; return 0;
err: err:
netsec_free_dring(priv, id); netsec_free_dring(priv, id);
return ret; return -ENOMEM;
} }
static int netsec_setup_rx_dring(struct netsec_priv *priv) static int netsec_setup_rx_dring(struct netsec_priv *priv)
......
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