[LEDE-DEV,4/7] ag71xx: Remove unnecessary goto statement.

Message ID 1512700637-47-4-git-send-email-rosenp@gmail.com
State New
Headers show
Series
  • [LEDE-DEV,1/7] ag71xx: Reorder some more structs based on warmth.
Related show

Commit Message

Rosen Penev Dec. 8, 2017, 2:37 a.m.
Tightens up the ag71xx_ring_alloc function and makes it easier to read.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c   | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Patch

diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index ffbe646..7518352 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -112,26 +112,17 @@  static void ag71xx_ring_free(struct ag71xx_ring *ring)
 static int ag71xx_ring_alloc(struct ag71xx_ring *ring)
 {
 	int ring_size = BIT(ring->order);
-	int err;
 
 	ring->descs_cpu = dma_alloc_coherent(NULL, ring_size * AG71XX_DESC_SIZE,
 					     &ring->descs_dma, GFP_ATOMIC);
-	if (!ring->descs_cpu) {
-		err = -ENOMEM;
-		goto err;
-	}
-
+	if (!ring->descs_cpu)
+		return -ENOMEM;
 
 	ring->buf = kzalloc(ring_size * sizeof(*ring->buf), GFP_KERNEL);
-	if (!ring->buf) {
-		err = -ENOMEM;
-		goto err;
-	}
+	if (!ring->buf)
+		return -ENOMEM;
 
 	return 0;
-
-err:
-	return err;
 }
 
 static void ag71xx_ring_tx_clean(struct ag71xx *ag)