mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
mdio-sun4i: Fix a memory leak
[ Upstream commit56c0290202] If the probing of the regulator is deferred, the memory allocated by 'mdiobus_alloc_size()' will be leaking. It should be freed before the next call to 'sun4i_mdio_probe()' which will reallocate it. Fixes:4bdcb1dd9f("net: Add MDIO bus driver for the Allwinner EMAC") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
63b9e4176b
commit
f49e50f830
@@ -128,8 +128,10 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
|
||||
|
||||
data->regulator = devm_regulator_get(&pdev->dev, "phy");
|
||||
if (IS_ERR(data->regulator)) {
|
||||
if (PTR_ERR(data->regulator) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
if (PTR_ERR(data->regulator) == -EPROBE_DEFER) {
|
||||
ret = -EPROBE_DEFER;
|
||||
goto err_out_free_mdiobus;
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev, "no regulator found\n");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user