diff mbox

mmc: omap_hsmmc: use IS_ERR macro for error checking

Message ID 1400160229-2578-1-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K May 15, 2014, 1:23 p.m. UTC
Debounce clock is optional, use IS_ERR macro instead of NULL pointer check.

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

Comments

Ulf Hansson May 21, 2014, 10:10 a.m. UTC | #1
On 15 May 2014 15:23, Balaji T K <balajitk@ti.com> wrote:
> Debounce clock is optional, use IS_ERR macro instead of NULL pointer check.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>

Thanks Balaji,

I will include this in the next PR I send to Chris.

Kind regards
Ulf Hansson
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" 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/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6b7b755..521eec3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1155,7 +1155,7 @@  static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
 
 	/* Disable the clocks */
 	pm_runtime_put_sync(host->dev);
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_disable_unprepare(host->dbclk);
 
 	/* Turn the power off */
@@ -1166,7 +1166,7 @@  static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
 		ret = mmc_slot(host).set_power(host->dev, host->slot_id, 1,
 					       vdd);
 	pm_runtime_get_sync(host->dev);
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_prepare_enable(host->dbclk);
 
 	if (ret != 0)
@@ -1947,12 +1947,8 @@  static int omap_hsmmc_probe(struct platform_device *pdev)
 	/*
 	 * MMC can still work without debounce clock.
 	 */
-	if (IS_ERR(host->dbclk)) {
-		host->dbclk = NULL;
-	} else if (clk_prepare_enable(host->dbclk) != 0) {
+	if (!IS_ERR(host->dbclk) && clk_prepare_enable(host->dbclk))
 		dev_warn(mmc_dev(host->mmc), "Failed to enable debounce clk\n");
-		host->dbclk = NULL;
-	}
 
 	/* Since we do only SG emulation, we can have as many segs
 	 * as we want. */
@@ -2103,7 +2099,7 @@  err_irq:
 		dma_release_channel(host->rx_chan);
 	pm_runtime_put_sync(host->dev);
 	pm_runtime_disable(host->dev);
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_disable_unprepare(host->dbclk);
 err1:
 	mmc_free_host(mmc);
@@ -2131,7 +2127,7 @@  static int omap_hsmmc_remove(struct platform_device *pdev)
 
 	pm_runtime_put_sync(host->dev);
 	pm_runtime_disable(host->dev);
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_disable_unprepare(host->dbclk);
 
 	omap_hsmmc_gpio_free(host->pdata);
@@ -2175,7 +2171,7 @@  static int omap_hsmmc_suspend(struct device *dev)
 				OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
 	}
 
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_disable_unprepare(host->dbclk);
 
 	pm_runtime_put_sync(host->dev);
@@ -2192,7 +2188,7 @@  static int omap_hsmmc_resume(struct device *dev)
 
 	pm_runtime_get_sync(host->dev);
 
-	if (host->dbclk)
+	if (!IS_ERR(host->dbclk))
 		clk_prepare_enable(host->dbclk);
 
 	if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))