* [PATCH 2/4] ll_temac: fix memory leak
@ 2010-07-08 12:10 Kulikov Vasiliy
2010-07-08 15:24 ` Grant Likely
2010-07-09 6:43 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Kulikov Vasiliy @ 2010-07-08 12:10 UTC (permalink / raw)
To: Kernel Janitors
Cc: David S. Miller, John Linn, Grant Likely, Jiri Pirko, Brian Hill,
netdev
If of_iomap() or irq_of_parse_and_map() fail then np must be freed.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] ll_temac: fix memory leak
2010-07-08 12:10 [PATCH 2/4] ll_temac: fix memory leak Kulikov Vasiliy
@ 2010-07-08 15:24 ` Grant Likely
2010-07-09 6:43 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Grant Likely @ 2010-07-08 15:24 UTC (permalink / raw)
To: Kulikov Vasiliy
Cc: Kernel Janitors, David S. Miller, John Linn, Jiri Pirko,
Brian Hill, netdev
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] ll_temac: fix memory leak
2010-07-08 12:10 [PATCH 2/4] ll_temac: fix memory leak Kulikov Vasiliy
2010-07-08 15:24 ` Grant Likely
@ 2010-07-09 6:43 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-07-09 6:43 UTC (permalink / raw)
To: segooon
Cc: kernel-janitors, john.linn, grant.likely, jpirko, brian.hill,
netdev
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Thu, 8 Jul 2010 16:10:03 +0400
> If of_iomap() or irq_of_parse_and_map() fail then np must be freed.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-09 6:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-08 12:10 [PATCH 2/4] ll_temac: fix memory leak Kulikov Vasiliy
2010-07-08 15:24 ` Grant Likely
2010-07-09 6:43 ` David Miller
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).