Commit ced1de4c authored by Denis Kirjanov's avatar Denis Kirjanov Committed by David S. Miller

r6040: Free irq line on error path

Free irq line on error path.
Signed-off-by: default avatarDenis Kirjanov <dkirjanov@kernel.org>
Acked-by: default avatarFlorian Fainelli <florian@openwrt.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0c54ace
...@@ -756,7 +756,7 @@ static int r6040_open(struct net_device *dev) ...@@ -756,7 +756,7 @@ static int r6040_open(struct net_device *dev)
ret = request_irq(dev->irq, r6040_interrupt, ret = request_irq(dev->irq, r6040_interrupt,
IRQF_SHARED, dev->name, dev); IRQF_SHARED, dev->name, dev);
if (ret) if (ret)
return ret; goto out;
/* Set MAC address */ /* Set MAC address */
r6040_mac_address(dev); r6040_mac_address(dev);
...@@ -764,30 +764,37 @@ static int r6040_open(struct net_device *dev) ...@@ -764,30 +764,37 @@ static int r6040_open(struct net_device *dev)
/* Allocate Descriptor memory */ /* Allocate Descriptor memory */
lp->rx_ring = lp->rx_ring =
pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma);
if (!lp->rx_ring) if (!lp->rx_ring) {
return -ENOMEM; ret = -ENOMEM;
goto err_free_irq;
}
lp->tx_ring = lp->tx_ring =
pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma);
if (!lp->tx_ring) { if (!lp->tx_ring) {
pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, ret = -ENOMEM;
lp->rx_ring_dma); goto err_free_rx_ring;
return -ENOMEM;
} }
ret = r6040_up(dev); ret = r6040_up(dev);
if (ret) { if (ret)
pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, goto err_free_tx_ring;
lp->tx_ring_dma);
pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring,
lp->rx_ring_dma);
return ret;
}
napi_enable(&lp->napi); napi_enable(&lp->napi);
netif_start_queue(dev); netif_start_queue(dev);
return 0; 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, static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment