From patchwork Thu May 15 13:23:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji T K X-Patchwork-Id: 4182501 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E2CC9F1C0 for ; Thu, 15 May 2014 13:23:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BE2C2037F for ; Thu, 15 May 2014 13:23:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BB8020251 for ; Thu, 15 May 2014 13:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751604AbaEONX4 (ORCPT ); Thu, 15 May 2014 09:23:56 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:53982 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbaEONX4 (ORCPT ); Thu, 15 May 2014 09:23:56 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4FDNkaE008375; Thu, 15 May 2014 08:23:46 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4FDNkGi006894; Thu, 15 May 2014 08:23:46 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 15 May 2014 08:23:46 -0500 Received: from ulaa0393241.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4FDNhCH011350; Thu, 15 May 2014 08:23:44 -0500 From: Balaji T K To: , , CC: , Balaji T K Subject: [PATCH] mmc: omap_hsmmc: use IS_ERR macro for error checking Date: Thu, 15 May 2014 18:53:49 +0530 Message-ID: <1400160229-2578-1-git-send-email-balajitk@ti.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Debounce clock is optional, use IS_ERR macro instead of NULL pointer check. Signed-off-by: Balaji T K --- drivers/mmc/host/omap_hsmmc.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) 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))