net: socionext: refactor netsec_alloc_dring()
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 8 Nov 2018 15:19:55 +0000 (17:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Nov 2018 03:42:41 +0000 (19:42 -0800)
return -ENOMEM directly instead of assigning it in a variable

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/socionext/netsec.c

index 9d24f299798ae114bad75cbb2c258aefba88bdfc..bba9733b5119c29374eca7894a0ee35dba1c3ae4 100644 (file)
@@ -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)
 {
        struct netsec_desc_ring *dring = &priv->desc_ring[id];
-       int ret = 0;
 
        dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
                                           &dring->desc_dma, GFP_KERNEL);
-       if (!dring->vaddr) {
-               ret = -ENOMEM;
+       if (!dring->vaddr)
                goto err;
-       }
 
        dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL);
-       if (!dring->desc) {
-               ret = -ENOMEM;
+       if (!dring->desc)
                goto err;
-       }
 
        return 0;
 err:
        netsec_free_dring(priv, id);
 
-       return ret;
+       return -ENOMEM;
 }
 
 static int netsec_setup_rx_dring(struct netsec_priv *priv)