From: Wolfram Sang <wsa@the-dreams.de>
To: linux-mmc@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
linux-renesas-soc@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
Ulf Hansson <ulf.hansson@linaro.org>
Subject: [RFC 4/4] mmc: sh_mobile_sdhi: check return value when changing clk
Date: Mon, 2 May 2016 22:25:42 +0200 [thread overview]
Message-ID: <1462220742-4426-5-git-send-email-wsa@the-dreams.de> (raw)
In-Reply-To: <1462220742-4426-1-git-send-email-wsa@the-dreams.de>
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
And return the old clock rate if something went wrong.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index ac9ba36da39b5b..5309c73be1f04f 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)
--
2.6.2
next prev parent reply other threads:[~2016-05-02 20:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 20:25 [RFC 0/4] mmc: tmio/sdhi: prevent regressions when setting clock Wolfram Sang
2016-05-02 20:25 ` [RFC 1/4] mmc: sh_mobile_sdhi: make clk_update function more compact Wolfram Sang
2016-05-02 20:25 ` [RFC 2/4] mmc: tmio/sdhi: introduce flag for RCar 2+ specific features Wolfram Sang
2016-05-02 20:25 ` [RFC 3/4] mmc: sh_mobile_sdhi: only change the clock on RCar Gen2+ Wolfram Sang
2016-05-02 20:25 ` Wolfram Sang [this message]
2016-05-03 7:30 ` [RFC 0/4] mmc: tmio/sdhi: prevent regressions when setting clock Geert Uytterhoeven
2016-05-03 8:49 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462220742-4426-5-git-send-email-wsa@the-dreams.de \
--to=wsa@the-dreams.de \
--cc=geert@linux-m68k.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).