diff options
| author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2018-03-18 18:59:36 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2018-03-20 12:06:23 -0400 |
| commit | 00777fac28ba3e126b9e63e789a613e8bd2cab25 (patch) | |
| tree | 397b53fe9c74e5bacde0e5a9030dbb70a80f6356 /drivers/net/ethernet/arc | |
| parent | 7fe4d6dcbcb43fe0282d4213fc52be178bb30e91 (diff) | |
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: 6eacf31139bf ("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>
Diffstat (limited to 'drivers/net/ethernet/arc')
| -rw-r--r-- | drivers/net/ethernet/arc/emac_rockchip.c | 6 |
1 files 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..0f6576802607 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) | |||
| 169 | /* Optional regulator for PHY */ | 169 | /* Optional regulator for PHY */ |
| 170 | priv->regulator = devm_regulator_get_optional(dev, "phy"); | 170 | priv->regulator = devm_regulator_get_optional(dev, "phy"); |
| 171 | if (IS_ERR(priv->regulator)) { | 171 | if (IS_ERR(priv->regulator)) { |
| 172 | if (PTR_ERR(priv->regulator) == -EPROBE_DEFER) | 172 | if (PTR_ERR(priv->regulator) == -EPROBE_DEFER) { |
| 173 | return -EPROBE_DEFER; | 173 | err = -EPROBE_DEFER; |
| 174 | goto out_clk_disable; | ||
| 175 | } | ||
| 174 | dev_err(dev, "no regulator found\n"); | 176 | dev_err(dev, "no regulator found\n"); |
| 175 | priv->regulator = NULL; | 177 | priv->regulator = NULL; |
| 176 | } | 178 | } |
