Skip to contentSkip to conversation

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

PATCH Applied Mark Brown 2 participants 2 messages Nov 4, 2014

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 mmc: sdhci-s3c: Check if clk_set_rate() succeeds

From: Mark Brown <[email protected]>

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.

---
 drivers/mmc/host/sdhci-s3c.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-s3c.c +7 -1
index 0ce6eb17deaf..4f7a63213b33 100644
@@ -300,6 +300,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;
 
 	host->mmc->actual_clock = 0;
 
@@ -311,7 +312,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;
+	}
 
 	clk = SDHCI_CLOCK_INT_EN;
 	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
Signature · 1 line
2.1.1
Applied
#1 lore raw
Quoted 7 lines · Mark Brown

From: Mark Brown <[email protected]>

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.

Thanks! Applied for next.

Kind regards
Uffe

Quoted 33 lines
---
 drivers/mmc/host/sdhci-s3c.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-s3c.c +7 -2
index 0ce6eb17deaf..4f7a63213b33 100644
@@ -300,6 +300,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;
 
        host->mmc->actual_clock = 0;
 
@@ -311,7 +312,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;
+       }
 
        clk = SDHCI_CLOCK_INT_EN;
        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
--

2.1.1