提交 f3f44d51 编写于 作者: W Wolfram Sang 提交者: Ulf Hansson

mmc: sh_mobile_sdhi: check return value when changing clk

And return the old clock rate if something went wrong.
Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 8fc00998
......@@ -166,7 +166,7 @@ static unsigned int sh_mobile_sdhi_clk_update(struct tmio_mmc_host *host,
{
struct sh_mobile_sdhi *priv = host_to_priv(host);
unsigned int freq, diff, best_freq = 0, diff_min = ~0;
int i;
int i, ret;
/* tested only on RCar Gen2+ currently; may work for others */
if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2))
......@@ -195,9 +195,9 @@ static unsigned int sh_mobile_sdhi_clk_update(struct tmio_mmc_host *host,
}
}
clk_set_rate(priv->clk, best_freq);
ret = clk_set_rate(priv->clk, best_freq);
return best_freq;
return ret == 0 ? best_freq : clk_get_rate(priv->clk);
}
static void sh_mobile_sdhi_clk_disable(struct tmio_mmc_host *host)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册