summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBranislav Radocaj <branislav@radocaj.org>2017-12-07 02:07:38 +0300
committerDavid S. Miller <davem@davemloft.net>2017-12-07 21:51:09 +0300
commite46772a6946a7d1f3fbbc1415871851d6651f1d4 (patch)
tree28c78ec43830de6dba6532ecd8d4c99646eb621b /drivers
parent589bf32f09852041fbd3b7ce1a9e703f95c230ba (diff)
downloadlinux-e46772a6946a7d1f3fbbc1415871851d6651f1d4.tar.xz
net: ethernet: arc: fix error handling in emac_rockchip_probe
If clk_set_rate() fails, we should disable clk before return. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Branislav Radocaj <branislav@radocaj.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/arc/emac_rockchip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index e278e3d96ee0..c6163874e4e7 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -220,9 +220,11 @@ static int emac_rockchip_probe(struct platform_device *pdev)
/* RMII TX/RX needs always a rate of 25MHz */
err = clk_set_rate(priv->macclk, 25000000);
- if (err)
+ if (err) {
dev_err(dev,
"failed to change mac clock rate (%d)\n", err);
+ goto out_clk_disable_macclk;
+ }
}
err = arc_emac_probe(ndev, interface);
@@ -232,7 +234,8 @@ static int emac_rockchip_probe(struct platform_device *pdev)
}
return 0;
-
+out_clk_disable_macclk:
+ clk_disable_unprepare(priv->macclk);
out_regulator_disable:
if (priv->regulator)
regulator_disable(priv->regulator);