diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2016-05-02 23:25:42 +0300 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-05-04 10:28:05 +0300 |
commit | f3f44d512cafef7e3d2cb140f642786dd6ec8818 (patch) | |
tree | 3dd5aeec4d893c1bbe49fc27044d37ea47dd5407 /drivers/mmc | |
parent | 8fc009986471729533fb1246c7ea9395635dac26 (diff) | |
download | linux-f3f44d512cafef7e3d2cb140f642786dd6ec8818.tar.xz |
mmc: sh_mobile_sdhi: check return value when changing clk
And return the old clock rate if something went wrong.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sh_mobile_sdhi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index ac9ba36da39b..5309c73be1f0 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -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) |