Skip to content

Commit 00777fa

Browse files
tititiou36davem330
authored andcommitted
net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
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: 6eacf31 ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7fe4d6d commit 00777fa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/arc/emac_rockchip.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,10 @@ static int emac_rockchip_probe(struct platform_device *pdev)
169169
/* Optional regulator for PHY */
170170
priv->regulator = devm_regulator_get_optional(dev, "phy");
171171
if (IS_ERR(priv->regulator)) {
172-
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER)
173-
return -EPROBE_DEFER;
172+
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER) {
173+
err = -EPROBE_DEFER;
174+
goto out_clk_disable;
175+
}
174176
dev_err(dev, "no regulator found\n");
175177
priv->regulator = NULL;
176178
}

0 commit comments

Comments
 (0)