mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
[ Upstream commit00777fac28] If the optional regulator is deferred, we must release some resources. They will be re-allocated when the probe function will be called again. Fixes:6eacf31139("ethernet: arc: Add support for Rockchip SoC layer device tree bindings") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
84fc2d7c22
commit
e9f83a8b4a
@@ -169,8 +169,10 @@ static int emac_rockchip_probe(struct platform_device *pdev)
|
||||
/* Optional regulator for PHY */
|
||||
priv->regulator = devm_regulator_get_optional(dev, "phy");
|
||||
if (IS_ERR(priv->regulator)) {
|
||||
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER) {
|
||||
err = -EPROBE_DEFER;
|
||||
goto out_clk_disable;
|
||||
}
|
||||
dev_err(dev, "no regulator found\n");
|
||||
priv->regulator = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user