From: Florian Fainelli <florian@openwrt•org>
To: Denis Kirjanov <dkirjanov@kernel•org>
Cc: davem@davemloft•net, netdev@vger•kernel.org
Subject: Re: [PATCH -next-2.6] r6040: Free irq line on error path
Date: Wed, 25 Aug 2010 12:05:08 +0200 [thread overview]
Message-ID: <201008251205.09065.florian@openwrt.org> (raw)
In-Reply-To: <20100825095755.GA8103@hera.kernel.org>
On Wednesday 25 August 2010 11:57:55 Denis Kirjanov wrote:
> Free irq line on error path.
>
> Signed-off-by: Denis Kirjanov <dkirjanov@kernel•org>
Acked-by: Florian Fainelli <florian@openwrt•org>
> ---
> 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 7d482a2..dc54aff 100644
> --- a/drivers/net/r6040.c
> +++ b/drivers/net/r6040.c
> @@ -751,7 +751,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);
> @@ -759,30 +759,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,
next prev parent reply other threads:[~2010-08-25 10:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-25 9:57 [PATCH -next-2.6] r6040: Free irq line on error path Denis Kirjanov
2010-08-25 10:05 ` Florian Fainelli [this message]
2010-08-25 23:41 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201008251205.09065.florian@openwrt.org \
--to=florian@openwrt$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=dkirjanov@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox