diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/moxa/moxart_ether.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index bd1a2d2bc2ae..ea54d95e5b9f 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c | |||
@@ -448,7 +448,8 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
448 | irq = irq_of_parse_and_map(node, 0); | 448 | irq = irq_of_parse_and_map(node, 0); |
449 | if (irq <= 0) { | 449 | if (irq <= 0) { |
450 | netdev_err(ndev, "irq_of_parse_and_map failed\n"); | 450 | netdev_err(ndev, "irq_of_parse_and_map failed\n"); |
451 | return -EINVAL; | 451 | ret = -EINVAL; |
452 | goto irq_map_fail; | ||
452 | } | 453 | } |
453 | 454 | ||
454 | priv = netdev_priv(ndev); | 455 | priv = netdev_priv(ndev); |
@@ -472,24 +473,32 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
472 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * | 473 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * |
473 | TX_DESC_NUM, &priv->tx_base, | 474 | TX_DESC_NUM, &priv->tx_base, |
474 | GFP_DMA | GFP_KERNEL); | 475 | GFP_DMA | GFP_KERNEL); |
475 | if (priv->tx_desc_base == NULL) | 476 | if (priv->tx_desc_base == NULL) { |
477 | ret = -ENOMEM; | ||
476 | goto init_fail; | 478 | goto init_fail; |
479 | } | ||
477 | 480 | ||
478 | priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * | 481 | priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * |
479 | RX_DESC_NUM, &priv->rx_base, | 482 | RX_DESC_NUM, &priv->rx_base, |
480 | GFP_DMA | GFP_KERNEL); | 483 | GFP_DMA | GFP_KERNEL); |
481 | if (priv->rx_desc_base == NULL) | 484 | if (priv->rx_desc_base == NULL) { |
485 | ret = -ENOMEM; | ||
482 | goto init_fail; | 486 | goto init_fail; |
487 | } | ||
483 | 488 | ||
484 | priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, | 489 | priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, |
485 | GFP_ATOMIC); | 490 | GFP_ATOMIC); |
486 | if (!priv->tx_buf_base) | 491 | if (!priv->tx_buf_base) { |
492 | ret = -ENOMEM; | ||
487 | goto init_fail; | 493 | goto init_fail; |
494 | } | ||
488 | 495 | ||
489 | priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, | 496 | priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, |
490 | GFP_ATOMIC); | 497 | GFP_ATOMIC); |
491 | if (!priv->rx_buf_base) | 498 | if (!priv->rx_buf_base) { |
499 | ret = -ENOMEM; | ||
492 | goto init_fail; | 500 | goto init_fail; |
501 | } | ||
493 | 502 | ||
494 | platform_set_drvdata(pdev, ndev); | 503 | platform_set_drvdata(pdev, ndev); |
495 | 504 | ||
@@ -522,7 +531,8 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
522 | init_fail: | 531 | init_fail: |
523 | netdev_err(ndev, "init failed\n"); | 532 | netdev_err(ndev, "init failed\n"); |
524 | moxart_mac_free_memory(ndev); | 533 | moxart_mac_free_memory(ndev); |
525 | 534 | irq_map_fail: | |
535 | free_netdev(ndev); | ||
526 | return ret; | 536 | return ret; |
527 | } | 537 | } |
528 | 538 | ||