LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
@ 2018-03-18 22:59 Christophe JAILLET
2018-03-20 16:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-03-18 22:59 UTC (permalink / raw)
To: heiko, branislav, davem
Cc: netdev, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel-janitors, Christophe JAILLET
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: 6eacf31139bf ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: v1 did not compile because of an erroneous variable name. s/ret/err/
---
drivers/net/ethernet/arc/emac_rockchip.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index 16f9bee992fe..8ee9dfd0e363 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -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;
}
--
2.14.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
2018-03-18 22:59 [PATCH v2] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred Christophe JAILLET
@ 2018-03-20 16:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-20 16:07 UTC (permalink / raw)
To: christophe.jaillet
Cc: heiko, branislav, netdev, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel-janitors
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sun, 18 Mar 2018 23:59:36 +0100
> 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: 6eacf31139bf ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: v1 did not compile because of an erroneous variable name. s/ret/err/
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-20 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-18 22:59 [PATCH v2] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred Christophe JAILLET
2018-03-20 16:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).