diff mbox

mmc: sdhci-s3c: Check if clk_set_rate() succeeds

Message ID 1377792936-775-1-git-send-email-broonie@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Brown Aug. 29, 2013, 4:15 p.m. UTC
From: Mark Brown <broonie@linaro.org>

It is possible that we may fail to set the clock rate, if we do so then
log the failure and don't bother reprogramming the IP.

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 drivers/mmc/host/sdhci-s3c.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jaehoon Chung Aug. 30, 2013, 8:21 a.m. UTC | #1
Looks good to me.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 08/30/2013 01:15 AM, Mark Brown wrote:
> From: Mark Brown <broonie@linaro.org>
> 
> It is possible that we may fail to set the clock rate, if we do so then
> log the failure and don't bother reprogramming the IP.
> 
> Signed-off-by: Mark Brown <broonie@linaro.org>
> ---
>  drivers/mmc/host/sdhci-s3c.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 926aaf6..d10de3f 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -295,6 +295,7 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
>  	struct device *dev = &ourhost->pdev->dev;
>  	unsigned long timeout;
>  	u16 clk = 0;
> +	int ret;
>  
>  	/* don't bother if the clock is going off */
>  	if (clock == 0)
> @@ -302,7 +303,12 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
>  
>  	sdhci_s3c_set_clock(host, clock);
>  
> -	clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
> +	ret = clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
> +	if (ret != 0) {
> +		dev_err(dev, "%s: failed to set clock rate %uHz\n",
> +			mmc_hostname(host->mmc), clock);
> +		return;
> +	}
>  
>  	host->clock = clock;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 926aaf6..d10de3f 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -295,6 +295,7 @@  static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
 	struct device *dev = &ourhost->pdev->dev;
 	unsigned long timeout;
 	u16 clk = 0;
+	int ret;
 
 	/* don't bother if the clock is going off */
 	if (clock == 0)
@@ -302,7 +303,12 @@  static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
 
 	sdhci_s3c_set_clock(host, clock);
 
-	clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
+	ret = clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
+	if (ret != 0) {
+		dev_err(dev, "%s: failed to set clock rate %uHz\n",
+			mmc_hostname(host->mmc), clock);
+		return;
+	}
 
 	host->clock = clock;