diff options
author | Denis Kirjanov <dkirjanov@kernel.org> | 2010-08-24 23:57:55 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-25 16:41:27 -0700 |
commit | ced1de4c9eeded664e5f1b21cfcb0fb70cc0cde3 (patch) | |
tree | 3d392a57c9bcc6f2356cf4f7e39e7b4aa254d47c /drivers/net/r6040.c | |
parent | f0c54ace9b74ec52e57d3ea2ef99fb277667abf8 (diff) | |
download | op-kernel-dev-ced1de4c9eeded664e5f1b21cfcb0fb70cc0cde3.zip op-kernel-dev-ced1de4c9eeded664e5f1b21cfcb0fb70cc0cde3.tar.gz |
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/r6040.c')
-rw-r--r-- | drivers/net/r6040.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 0a00850..63db065 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c @@ -756,7 +756,7 @@ static int r6040_open(struct net_device *dev) ret = request_irq(dev->irq, r6040_interrupt, IRQF_SHARED, dev->name, dev); if (ret) - return ret; + goto out; /* Set MAC address */ r6040_mac_address(dev); @@ -764,30 +764,37 @@ static int r6040_open(struct net_device *dev) /* Allocate Descriptor memory */ lp->rx_ring = pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); - if (!lp->rx_ring) - return -ENOMEM; + if (!lp->rx_ring) { + ret = -ENOMEM; + goto err_free_irq; + } lp->tx_ring = pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); if (!lp->tx_ring) { - pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, - lp->rx_ring_dma); - return -ENOMEM; + ret = -ENOMEM; + goto err_free_rx_ring; } ret = r6040_up(dev); - if (ret) { - pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, - lp->tx_ring_dma); - pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, - lp->rx_ring_dma); - return ret; - } + if (ret) + goto err_free_tx_ring; napi_enable(&lp->napi); netif_start_queue(dev); return 0; + +err_free_tx_ring: + pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, + lp->tx_ring_dma); +err_free_rx_ring: + pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, + lp->rx_ring_dma); +err_free_irq: + free_irq(dev->irq, dev); +out: + return ret; } static netdev_tx_t r6040_start_xmit(struct sk_buff *skb, |