* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-13 16:01 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-13 16:01 UTC (permalink / raw)
To: Ulf Hansson, Maxime Ripard, Chen-Yu Tsai
Cc: linux-sunxi, linux-mmc, linux-arm-kernel
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
This patch was initially sent in a patch series about the MMC new mode,
but it may be applied independently.
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-13 16:01 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-13 16:01 UTC (permalink / raw)
To: Ulf Hansson, Maxime Ripard, Chen-Yu Tsai
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
This patch was initially sent in a patch series about the MMC new mode,
but it may be applied independently.
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-13 16:01 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-13 16:01 UTC (permalink / raw)
To: Ulf Hansson, Maxime Ripard, Chen-Yu Tsai
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
This patch was initially sent in a patch series about the MMC new mode,
but it may be applied independently.
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-13 16:01 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-13 16:01 UTC (permalink / raw)
To: Ulf Hansson, Maxime Ripard, Chen-Yu Tsai
Cc: linux-sunxi, linux-mmc, linux-arm-kernel
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
This patch was initially sent in a patch series about the MMC new mode,
but it may be applied independently.
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <57af4930.2866c20a.efdbe.7721SMTPIN_ADDED_MISSING@mx.google.com>]
* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-23 8:51 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-23 8:51 UTC (permalink / raw)
To: Ulf Hansson, Chen-Yu Tsai, Maxime Ripard
Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
Rebase on linux-next
---
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 2ec91ce..142ab3f 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -692,7 +692,8 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
struct mmc_ios *ios)
{
- u32 rate, rval, clock = ios->clock;
+ long rate;
+ u32 rval, clock = ios->clock;
int ret;
/* 8 bit DDR requires a higher module clock */
@@ -701,13 +702,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.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate
@ 2016-08-23 8:51 Jean-Francois Moine
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Francois Moine @ 2016-08-23 8:51 UTC (permalink / raw)
To: Ulf Hansson, Chen-Yu Tsai, Maxime Ripard
Cc: linux-sunxi, linux-mmc, linux-arm-kernel
clk_round_rate() may return an error. Check it.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
Rebase on linux-next
---
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 2ec91ce..142ab3f 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -692,7 +692,8 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
struct mmc_ios *ios)
{
- u32 rate, rval, clock = ios->clock;
+ long rate;
+ u32 rval, clock = ios->clock;
int ret;
/* 8 bit DDR requires a higher module clock */
@@ -701,13 +702,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.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <57bc12b2.9be81c0a.1246a.9f47SMTPIN_ADDED_MISSING@mx.google.com>]
end of thread, other threads:[~2016-08-24 9:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-13 16:01 [PATCH RESEND] mmc: sunxi: Check the value returned by clk_round_rate Jean-Francois Moine
-- strict thread matches above, loose matches on Subject: below --
2016-08-13 16:01 Jean-Francois Moine
2016-08-13 16:01 Jean-Francois Moine
2016-08-13 16:01 Jean-Francois Moine
[not found] <57af4930.2866c20a.efdbe.7721SMTPIN_ADDED_MISSING@mx.google.com>
[not found] ` <57af4930.2866c20a.efdbe.7721SMTPIN_ADDED_MISSING-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
2016-08-22 13:53 ` Ulf Hansson
2016-08-23 8:51 Jean-Francois Moine
2016-08-23 8:51 Jean-Francois Moine
[not found] <57bc12b2.9be81c0a.1246a.9f47SMTPIN_ADDED_MISSING@mx.google.com>
[not found] ` <57bc12b2.9be81c0a.1246a.9f47SMTPIN_ADDED_MISSING-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
2016-08-24 9:32 ` Ulf Hansson
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).