diff mbox series

[net-next,2/2] net: socionext: refactor netsec_alloc_dring()

Message ID 1541690395-8337-2-git-send-email-ilias.apalodimas@linaro.org
State New
Headers show
Series [net-next,1/2] net: socionext: different approach on DMA | expand

Commit Message

Ilias Apalodimas Nov. 8, 2018, 3:19 p.m. UTC
return -ENOMEM directly instead of assigning it in a variable

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 drivers/net/ethernet/socionext/netsec.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

-- 
2.7.4

Comments

David Miller Nov. 9, 2018, 3:43 a.m. UTC | #1
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Date: Thu,  8 Nov 2018 17:19:55 +0200

> return -ENOMEM directly instead of assigning it in a variable

> 

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


Applied.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 9d24f29..bba9733 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -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)