aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 0a00850da79d..63db065508f4 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -756,7 +756,7 @@ static int r6040_open(struct net_device *dev)
756 ret = request_irq(dev->irq, r6040_interrupt, 756 ret = request_irq(dev->irq, r6040_interrupt,
757 IRQF_SHARED, dev->name, dev); 757 IRQF_SHARED, dev->name, dev);
758 if (ret) 758 if (ret)
759 return ret; 759 goto out;
760 760
761 /* Set MAC address */ 761 /* Set MAC address */
762 r6040_mac_address(dev); 762 r6040_mac_address(dev);
@@ -764,30 +764,37 @@ static int r6040_open(struct net_device *dev)
764 /* Allocate Descriptor memory */ 764 /* Allocate Descriptor memory */
765 lp->rx_ring = 765 lp->rx_ring =
766 pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); 766 pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma);
767 if (!lp->rx_ring) 767 if (!lp->rx_ring) {
768 return -ENOMEM; 768 ret = -ENOMEM;
769 goto err_free_irq;
770 }
769 771
770 lp->tx_ring = 772 lp->tx_ring =
771 pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); 773 pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma);
772 if (!lp->tx_ring) { 774 if (!lp->tx_ring) {
773 pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, 775 ret = -ENOMEM;
774 lp->rx_ring_dma); 776 goto err_free_rx_ring;
775 return -ENOMEM;
776 } 777 }
777 778
778 ret = r6040_up(dev); 779 ret = r6040_up(dev);
779 if (ret) { 780 if (ret)
780 pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, 781 goto err_free_tx_ring;
781 lp->tx_ring_dma);
782 pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring,
783 lp->rx_ring_dma);
784 return ret;
785 }
786 782
787 napi_enable(&lp->napi); 783 napi_enable(&lp->napi);
788 netif_start_queue(dev); 784 netif_start_queue(dev);
789 785
790 return 0; 786 return 0;
787
788err_free_tx_ring:
789 pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring,
790 lp->tx_ring_dma);
791err_free_rx_ring:
792 pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring,
793 lp->rx_ring_dma);
794err_free_irq:
795 free_irq(dev->irq, dev);
796out:
797 return ret;
791} 798}
792 799
793static netdev_tx_t r6040_start_xmit(struct sk_buff *skb, 800static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,