From: Grant Likely <grant.likely@secretlab.ca>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: Kernel Janitors <kernel-janitors@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
John Linn <john.linn@xilinx.com>, Jiri Pirko <jpirko@redhat.com>,
Brian Hill <brian.hill@xilinx.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 2/4] ll_temac: fix memory leak
Date: Thu, 8 Jul 2010 09:24:41 -0600 [thread overview]
Message-ID: <AANLkTin8F8xb5QSOB-3JwEOJLbKFTUOcyg93-SHn4mar@mail.gmail.com> (raw)
In-Reply-To: <1278591006-3156-1-git-send-email-segooon@gmail.com>
On Thu, Jul 8, 2010 at 6:10 AM, Kulikov Vasiliy <segooon@gmail.com> wrote:
> If of_iomap() or irq_of_parse_and_map() fail then np must be freed.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Looks correct to me.
g.
> ---
> drivers/net/ll_temac_main.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
> index 5bca20b..a2da3d7 100644
> --- a/drivers/net/ll_temac_main.c
> +++ b/drivers/net/ll_temac_main.c
> @@ -999,19 +999,22 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
> dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
> } else {
> dev_err(&op->dev, "unable to map DMA registers\n");
> + of_node_put(np);
> goto err_iounmap;
> }
> }
>
> lp->rx_irq = irq_of_parse_and_map(np, 0);
> lp->tx_irq = irq_of_parse_and_map(np, 1);
> +
> + of_node_put(np); /* Finished with the DMA node; drop the reference */
> +
> if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) {
> dev_err(&op->dev, "could not determine irqs\n");
> rc = -ENOMEM;
> goto err_iounmap_2;
> }
>
> - of_node_put(np); /* Finished with the DMA node; drop the reference */
>
> /* Retrieve the MAC address */
> addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
> --
> 1.7.0.4
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2010-07-08 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 12:10 [PATCH 2/4] ll_temac: fix memory leak Kulikov Vasiliy
2010-07-08 15:24 ` Grant Likely [this message]
2010-07-09 6:43 ` 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=AANLkTin8F8xb5QSOB-3JwEOJLbKFTUOcyg93-SHn4mar@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=brian.hill@xilinx.com \
--cc=davem@davemloft.net \
--cc=john.linn@xilinx.com \
--cc=jpirko@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=segooon@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).