[LEDE-DEV] [PATCH 4/7] ag71xx: Remove unnecessary goto statement.
Rosen Penev
rosenp at gmail.com
Thu Dec 7 18:37:14 PST 2017
Tightens up the ag71xx_ring_alloc function and makes it easier to read.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
.../drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
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)
--
2.7.4
More information about the Lede-dev
mailing list