From: moinejf@free.fr (Jean-Francois Moine)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] mmc: sunxi: Check the value returned by clk_round_rate
Date: Wed, 20 Jul 2016 20:01:47 +0200 [thread overview]
Message-ID: <c2231f3df66cf77e4fb9051f7b0c27ea69b8e63d.1469082481.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1469082481.git.moinejf@free.fr>
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
drivers/mmc/host/sunxi-mmc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 2ee4c21..ba647b7 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -656,7 +656,8 @@ static int sunxi_mmc_oclk_onoff(struct sunxi_mmc_host *host, u32 oclk_en)
static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
struct mmc_ios *ios)
{
- u32 rate, oclk_dly, rval, sclk_dly;
+ long rate;
+ u32 oclk_dly, rval, sclk_dly;
u32 clock = ios->clock;
int ret;
@@ -666,13 +667,18 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
clock <<= 1;
rate = clk_round_rate(host->clk_mmc, clock);
- dev_dbg(mmc_dev(host->mmc), "setting clk to %d, rounded %d\n",
+ if (rate < 0) {
+ dev_err(mmc_dev(host->mmc), "error rounding clk to %d: %ld\n",
+ clock, rate);
+ return rate;
+ }
+ dev_dbg(mmc_dev(host->mmc), "setting clk to %d, rounded %ld\n",
clock, rate);
/* setting clock rate */
ret = clk_set_rate(host->clk_mmc, rate);
if (ret) {
- dev_err(mmc_dev(host->mmc), "error setting clk to %d: %d\n",
+ dev_err(mmc_dev(host->mmc), "error setting clk to %ld: %d\n",
rate, ret);
return ret;
}
--
2.9.2
next prev parent reply other threads:[~2016-07-20 18:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 6:28 [PATCH 0/3] mmc: sunxi: Changes in the host driver Jean-Francois Moine
2016-07-20 18:01 ` Jean-Francois Moine [this message]
2016-07-21 8:49 ` [PATCH 1/3] mmc: sunxi: Check the value returned by clk_round_rate Maxime Ripard
2016-07-20 18:16 ` [PATCH 2/3] mmc: sunxi: Set the 'New Timing' register for 8 bits DDR transfers Jean-Francois Moine
2016-07-21 8:56 ` Maxime Ripard
2016-07-21 9:26 ` Jean-Francois Moine
2016-07-29 19:17 ` Maxime Ripard
2016-07-30 5:18 ` Jean-Francois Moine
2016-07-30 10:19 ` [linux-sunxi] " Hans de Goede
2016-08-01 13:52 ` Jean-Francois Moine
2016-08-02 8:37 ` Hans de Goede
2016-07-29 19:36 ` Maxime Ripard
2016-07-30 5:20 ` Jean-Francois Moine
2016-07-20 18:28 ` [PATCH 3/3] mmc: sunxi: Add support to the Allwinner A83T Jean-Francois Moine
2016-07-21 8:58 ` Maxime Ripard
2016-07-21 9:18 ` Jean-Francois Moine
2016-07-22 19:00 ` Jean-Francois Moine
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=c2231f3df66cf77e4fb9051f7b0c27ea69b8e63d.1469082481.git.moinejf@free.fr \
--to=moinejf@free.fr \
--cc=linux-arm-kernel@lists.infradead.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).