Skip to content

Commit

Permalink
net: ethernet: arc: fix error handling in emac_rockchip_probe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Branislav Radocaj authored and David S. Miller committed Dec 7, 2017
1 parent 589bf32 commit e46772a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/ethernet/arc/emac_rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e46772a

Please sign in to comment.