From patchwork Wed Jun 7 08:36:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 9770891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3EE2160364 for ; Wed, 7 Jun 2017 08:37:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25AEC1FFB7 for ; Wed, 7 Jun 2017 08:37:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A66C28512; Wed, 7 Jun 2017 08:37:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B101FFB7 for ; Wed, 7 Jun 2017 08:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbdFGIhQ (ORCPT ); Wed, 7 Jun 2017 04:37:16 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:27215 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbdFGIhD (ORCPT ); Wed, 7 Jun 2017 04:37:03 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v578aac8018134; Wed, 7 Jun 2017 03:36:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1496824596; bh=jrhHdLh/CFFTccuBgAWfsvbBspTcmPQPQJi52T8P/Fw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=e+VlSF82IAVd3fwFNs3PhFmmO1CGVMGp31Zm2VZUtr11rdza/BncweenHBW1viV0i pTef54eRYuJqjtgiXJotwhl3GspPed3YphndnwpLgX62Mb/aIhn0iPv84IvrWLD8Kv LQu7oEgGxCnM8krC/qVsL3J4tjOtodyiPdr8Ija0= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v578aaeF000537; Wed, 7 Jun 2017 03:36:36 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Wed, 7 Jun 2017 03:36:35 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v578aOQ9023424; Wed, 7 Jun 2017 03:36:31 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Rob Herring , CC: , , , , , Subject: [PATCH 1/3] mmc: host: omap_hsmmc: Do not initialize MMC regulators to NULL on error Date: Wed, 7 Jun 2017 14:06:10 +0530 Message-ID: <20170607083612.14224-2-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170607083612.14224-1-kishon@ti.com> References: <20170607083612.14224-1-kishon@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do not initialize MMC regulators to NULL on error in omap_hsmmc driver similar to what is done in mmc_regulator_get_supply(). This is in preparation for using mmc_regulator_get_supply() to get MMC regulators. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/omap_hsmmc.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 8c39dccacf39..de82ac0a87e2 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -250,14 +250,14 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc) struct omap_hsmmc_host *host = mmc_priv(mmc); struct mmc_ios *ios = &mmc->ios; - if (mmc->supply.vmmc) { + if (!IS_ERR(mmc->supply.vmmc)) { ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); if (ret) return ret; } /* Enable interface voltage rail, if needed */ - if (mmc->supply.vqmmc && !host->vqmmc_enabled) { + if (!IS_ERR(mmc->supply.vqmmc) && !host->vqmmc_enabled) { ret = regulator_enable(mmc->supply.vqmmc); if (ret) { dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n"); @@ -269,7 +269,7 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc) return 0; err_vqmmc: - if (mmc->supply.vmmc) + if (!IS_ERR(mmc->supply.vmmc)) mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); return ret; @@ -281,7 +281,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc) int status; struct omap_hsmmc_host *host = mmc_priv(mmc); - if (mmc->supply.vqmmc && host->vqmmc_enabled) { + if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) { ret = regulator_disable(mmc->supply.vqmmc); if (ret) { dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n"); @@ -290,7 +290,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc) host->vqmmc_enabled = 0; } - if (mmc->supply.vmmc) { + if (!IS_ERR(mmc->supply.vmmc)) { ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); if (ret) goto err_set_ocr; @@ -299,7 +299,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc) return 0; err_set_ocr: - if (mmc->supply.vqmmc) { + if (!IS_ERR(mmc->supply.vqmmc)) { status = regulator_enable(mmc->supply.vqmmc); if (status) dev_err(mmc_dev(mmc), "vmmc_aux re-enable failed\n"); @@ -313,7 +313,7 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on, { int ret; - if (!host->pbias) + if (IS_ERR(host->pbias)) return 0; if (power_on) { @@ -363,7 +363,7 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on, * If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ - if (!mmc->supply.vmmc) + if (IS_ERR(mmc->supply.vmmc)) return 0; if (mmc_pdata(host)->before_set_reg) @@ -415,7 +415,7 @@ static int omap_hsmmc_disable_boot_regulator(struct regulator *reg) { int ret; - if (!reg) + if (IS_ERR(reg)) return 0; if (regulator_is_enabled(reg)) { @@ -480,7 +480,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) return ret; dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", PTR_ERR(mmc->supply.vmmc)); - mmc->supply.vmmc = NULL; } else { ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc); if (ocr_value > 0) @@ -495,7 +494,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) return ret; dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", PTR_ERR(mmc->supply.vqmmc)); - mmc->supply.vqmmc = NULL; } host->pbias = devm_regulator_get_optional(host->dev, "pbias"); @@ -508,7 +506,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) } dev_dbg(host->dev, "unable to get pbias regulator %ld\n", PTR_ERR(host->pbias)); - host->pbias = NULL; } /* For eMMC do not power off when not in sleep state */