All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Grundler <grantgrundler@gmail.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
	Grant Grundler <grundler@parisc-linux.org>
Subject: Re: [PATCH net-next #2 23/39] uli526x: fix regions leak in driver probe error path.
Date: Fri, 6 Apr 2012 10:15:21 -0700	[thread overview]
Message-ID: <CANEJEGvv9fJ8ZTrifwRk=7dzUycszrSO1dayL4faa3=G-66X-g@mail.gmail.com> (raw)
In-Reply-To: <5a61e7c690fce53cd37eddc9808134bc0e6b9837.1333704409.git.romieu@fr.zoreil.com>

On Fri, Apr 6, 2012 at 3:06 AM, Francois Romieu <romieu@fr.zoreil.com> wrote:
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Grant Grundler <grundler@parisc-linux.org>

Ack-by: Grant Grundler <grundler@parisc-linux.org>

I'm assuming uli526x_remove_one() is called after uli526x_stop()
(which quiesces the HW). That appears to be the case for tulip_core.c
as well - so this should be ok.

thanks,
grant

> ---
>  drivers/net/ethernet/dec/tulip/uli526x.c |   48 ++++++++++++-----------------
>  1 files changed, 20 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
> index fc4001f..c9b3396 100644
> --- a/drivers/net/ethernet/dec/tulip/uli526x.c
> +++ b/drivers/net/ethernet/dec/tulip/uli526x.c
> @@ -313,9 +313,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
>                goto err_out_disable;
>        }
>
> -       if (pci_request_regions(pdev, DRV_NAME)) {
> +       err = pci_request_regions(pdev, DRV_NAME);
> +       if (err < 0) {
>                pr_err("Failed to request PCI regions\n");
> -               err = -ENODEV;
>                goto err_out_disable;
>        }
>
> @@ -323,18 +323,15 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
>        db = netdev_priv(dev);
>
>        /* Allocate Tx/Rx descriptor memory */
> +       err = -ENOMEM;
> +
>        db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
> -       if(db->desc_pool_ptr == NULL)
> -       {
> -               err = -ENOMEM;
> -               goto err_out_nomem;
> -       }
> +       if (!db->desc_pool_ptr)
> +               goto err_out_release;
> +
>        db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
> -       if(db->buf_pool_ptr == NULL)
> -       {
> -               err = -ENOMEM;
> -               goto err_out_nomem;
> -       }
> +       if (!db->buf_pool_ptr)
> +               goto err_out_free_tx_desc;
>
>        db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
>        db->first_tx_desc_dma = db->desc_pool_dma_ptr;
> @@ -387,7 +384,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
>        }
>        err = register_netdev (dev);
>        if (err)
> -               goto err_out_res;
> +               goto err_out_free_tx_buf;
>
>        netdev_info(dev, "ULi M%04lx at pci%s, %pM, irq %d\n",
>                    ent->driver_data >> 16, pci_name(pdev),
> @@ -397,16 +394,14 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
>
>        return 0;
>
> -err_out_res:
> +err_out_free_tx_buf:
> +       pci_free_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
> +                           db->buf_pool_ptr, db->buf_pool_dma_ptr);
> +err_out_free_tx_desc:
> +       pci_free_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
> +                           db->desc_pool_ptr, db->desc_pool_dma_ptr);
> +err_out_release:
>        pci_release_regions(pdev);
> -err_out_nomem:
> -       if(db->desc_pool_ptr)
> -               pci_free_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
> -                       db->desc_pool_ptr, db->desc_pool_dma_ptr);
> -
> -       if(db->buf_pool_ptr != NULL)
> -               pci_free_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
> -                       db->buf_pool_ptr, db->buf_pool_dma_ptr);
>  err_out_disable:
>        pci_disable_device(pdev);
>  err_out_free:
> @@ -422,19 +417,16 @@ static void __devexit uli526x_remove_one (struct pci_dev *pdev)
>        struct net_device *dev = pci_get_drvdata(pdev);
>        struct uli526x_board_info *db = netdev_priv(dev);
>
> -       ULI526X_DBUG(0, "uli526x_remove_one()", 0);
> -
> +       unregister_netdev(dev);
>        pci_free_consistent(db->pdev, sizeof(struct tx_desc) *
>                                DESC_ALL_CNT + 0x20, db->desc_pool_ptr,
>                                db->desc_pool_dma_ptr);
>        pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
>                                db->buf_pool_ptr, db->buf_pool_dma_ptr);
> -       unregister_netdev(dev);
>        pci_release_regions(pdev);
> -       free_netdev(dev);       /* free board information */
> -       pci_set_drvdata(pdev, NULL);
>        pci_disable_device(pdev);
> -       ULI526X_DBUG(0, "uli526x_remove_one() exit", 0);
> +       pci_set_drvdata(pdev, NULL);
> +       free_netdev(dev);
>  }
>
>
> --
> 1.7.7.6
>

  reply	other threads:[~2012-04-06 17:15 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 10:06 [PATCH net-next #2 00/39] net_device.{base_addr, irq} removal update Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 01/39] sungem: stop using net_device.{base_addr, irq} Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 02/39] tehuti: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 03/39] forcedeth: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 04/39] atl1c: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 05/39] via-rhine: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 06/39] hamachi: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 07/39] via-velocity: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 08/39] sundance: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 09/39] vxge: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 10/39] fealnx: " Francois Romieu
2012-04-06 10:21   ` David Miller
2012-04-06 10:06 ` [PATCH net-next #2 11/39] atl1e: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 12/39] s2io: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 13/39] 8139cp: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 14/39] yellowfin: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 15/39] starfire: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 16/39] starfire: remove deprecated options Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 17/39] bnx2: stop using net_device.{base_addr, irq} Francois Romieu
2012-04-06 15:07   ` Michael Chan
2012-04-06 10:06 ` [PATCH net-next #2 18/39] winbond840: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 19/39] sc92031: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 20/39] sis190: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 21/39] tulip_core: " Francois Romieu
2012-04-06 16:57   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 22/39] sunhme: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 23/39] uli526x: fix regions leak in driver probe error path Francois Romieu
2012-04-06 17:15   ` Grant Grundler [this message]
2012-04-06 10:06 ` [PATCH net-next #2 24/39] xircom_cb: fix device " Francois Romieu
2012-04-06 16:56   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 25/39] xircom_cb: stop using net_device.{base_addr, irq} and convert to __iomem Francois Romieu
2012-04-06 16:42   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 26/39] de2104x: stop using net_device.{base_addr, irq} Francois Romieu
2012-04-06 16:54   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 27/39] smsc9420: " Francois Romieu
2012-04-06 10:23   ` David Miller
2012-04-06 10:06 ` [PATCH net-next #2 28/39] natsemi: " Francois Romieu
2012-04-10 22:53   ` Tim Hockin
2012-04-10 23:30     ` David Miller
2012-04-10 23:39       ` Tim Hockin
2012-04-11  0:02         ` David Miller
2012-04-11  0:19           ` Tim Hockin
2012-04-11  0:42             ` David Miller
2012-04-11  0:59               ` Tim Hockin
2012-04-11  1:11                 ` David Miller
2012-04-11  1:16                   ` Tim Hockin
2012-04-06 10:06 ` [PATCH net-next #2 29/39] 8139too: dev->{base_addr, irq} removal Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 30/39] dl2k: stop using net_device.{base_addr, irq} and convert to __iomem Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 31/39] uli526x: " Francois Romieu
2012-04-06 16:53   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 32/39] epic100: " Francois Romieu
2012-04-06 10:25   ` David Miller
2012-04-06 10:06 ` [PATCH net-next #2 33/39] dmfe: " Francois Romieu
2012-04-06 16:31   ` Grant Grundler
2012-04-06 10:06 ` [PATCH net-next #2 34/39] sis900: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 35/39] myri10ge: stop using net_device.{base_addr, irq} Francois Romieu
2012-04-06 11:48   ` Andrew Gallatin
2012-04-06 10:06 ` [PATCH net-next #2 36/39] rrunner: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 37/39] ipw2200: " Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 38/39] ipw2100: stop using net_device.base_addr Francois Romieu
2012-04-06 10:06 ` [PATCH net-next #2 39/39] ipw2100: remove useless tests in the PCI device remove path Francois Romieu
2012-04-06 10:26 ` [PATCH net-next #2 00/39] net_device.{base_addr, irq} removal update David Miller
2012-04-06 17:17   ` Grant Grundler

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='CANEJEGvv9fJ8ZTrifwRk=7dzUycszrSO1dayL4faa3=G-66X-g@mail.gmail.com' \
    --to=grantgrundler@gmail.com \
    --cc=davem@davemloft.net \
    --cc=grundler@parisc-linux.org \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.