aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-09 02:43:20 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-09 02:43:20 -0400
commit7cc36f6f7116918c8a8990a0f23f62d2288a81bf (patch)
treec7acec6340939e016e01be98a88cb68b8e941a7b /drivers/net
parent9f1e7582749980b51da67671b2536aadca3596b8 (diff)
ll_temac: fix memory leak
If of_iomap() or irq_of_parse_and_map() fail then np must be freed. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ll_temac_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index b57d0ff52519..6ebf808bf440 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -1031,19 +1031,22 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
1031 dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs); 1031 dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
1032 } else { 1032 } else {
1033 dev_err(&op->dev, "unable to map DMA registers\n"); 1033 dev_err(&op->dev, "unable to map DMA registers\n");
1034 of_node_put(np);
1034 goto err_iounmap; 1035 goto err_iounmap;
1035 } 1036 }
1036 } 1037 }
1037 1038
1038 lp->rx_irq = irq_of_parse_and_map(np, 0); 1039 lp->rx_irq = irq_of_parse_and_map(np, 0);
1039 lp->tx_irq = irq_of_parse_and_map(np, 1); 1040 lp->tx_irq = irq_of_parse_and_map(np, 1);
1041
1042 of_node_put(np); /* Finished with the DMA node; drop the reference */
1043
1040 if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { 1044 if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) {
1041 dev_err(&op->dev, "could not determine irqs\n"); 1045 dev_err(&op->dev, "could not determine irqs\n");
1042 rc = -ENOMEM; 1046 rc = -ENOMEM;
1043 goto err_iounmap_2; 1047 goto err_iounmap_2;
1044 } 1048 }
1045 1049
1046 of_node_put(np); /* Finished with the DMA node; drop the reference */
1047 1050
1048 /* Retrieve the MAC address */ 1051 /* Retrieve the MAC address */
1049 addr = of_get_property(op->dev.of_node, "local-mac-address", &size); 1052 addr = of_get_property(op->dev.of_node, "local-mac-address", &size);