aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@kernel.org>2010-08-24 19:57:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-25 19:41:27 -0400
commitced1de4c9eeded664e5f1b21cfcb0fb70cc0cde3 (patch)
tree3d392a57c9bcc6f2356cf4f7e39e7b4aa254d47c /drivers/net
parentf0c54ace9b74ec52e57d3ea2ef99fb277667abf8 (diff)
r6040: Free irq line on error path
Free irq line on error path. Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-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,