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>
This commit is contained in:
parent
9f1e758274
commit
7cc36f6f71
drivers/net
|
@ -1031,19 +1031,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);
|
dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
|
||||||
} else {
|
} else {
|
||||||
dev_err(&op->dev, "unable to map DMA registers\n");
|
dev_err(&op->dev, "unable to map DMA registers\n");
|
||||||
|
of_node_put(np);
|
||||||
goto err_iounmap;
|
goto err_iounmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lp->rx_irq = irq_of_parse_and_map(np, 0);
|
lp->rx_irq = irq_of_parse_and_map(np, 0);
|
||||||
lp->tx_irq = irq_of_parse_and_map(np, 1);
|
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)) {
|
if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) {
|
||||||
dev_err(&op->dev, "could not determine irqs\n");
|
dev_err(&op->dev, "could not determine irqs\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_iounmap_2;
|
goto err_iounmap_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
of_node_put(np); /* Finished with the DMA node; drop the reference */
|
|
||||||
|
|
||||||
/* Retrieve the MAC address */
|
/* Retrieve the MAC address */
|
||||||
addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
|
addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
|
||||||
|
|
Loading…
Reference in New Issue