From patchwork Fri May 21 12:36:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12273023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B7EC433ED for ; Fri, 21 May 2021 12:47:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7D1E613D9 for ; Fri, 21 May 2021 12:47:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7D1E613D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=wanadoo.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9f/GPCJE/hCXzVgEUJ1X6IWTVKTTsoo+CYnx5EobLwA=; b=HqbqiAOJlA5cxDCHnoPvJ9Wf6W Oq43GLoYj4SriRLugASEo6mFHYJJy3AWBPLE0tJFEwqlYgKJN8ThrRFII2fYZYRpaguQ9JCpN2F6k sbpnnlyeK7Z6qQ7GXbgMicRWVnhTPWdoeq2t6dv2QjNNF4tCj+X1kMxkEna8vJdj6P8ZF9NPxSyIx eImYe87IFdC+n00pciKnmi4P8MkdcfdCEq+762mBlO0WtDnugaDwCA4gRfUXmewdICSTOemxPS0hV du/RYM7Sw6ld1Uv4ZL+miB0zmOE8mR+z9mnbOQpD4p+/LtCKCAJbfc0ST7JhKRzjVPsAY+obZ671m JS+rL8sA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk4Vw-005M4U-Qu; Fri, 21 May 2021 12:44:30 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk4Vu-005M4I-Lz for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 12:44:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=u3plUVShUUE8QK+7Ab371aAy2jGuVSz0YacilTjK/zo=; b=woX3uf6hTBM6IZ+eTfgUIDcXXP kn4DjtqbH4rspj/lsUb8dNEYAw2YXvvGhcJHPtrU2xaMLR92RV/qX4jJaSE2raWS7ylRGVW59bmXo 6XTXP68GzfycA5Ciy2UVO6Q/xwyouQG1cqSpxVmKhdCFRPs5ZGbkEzQvYgX4DbWTKjpjmB+ete200 EZlhypgm0hmEZJmogX2cKIGzmo7mUqKs3+6kWW4D38vLLjLIv20jOu5RNGxxZLzeqq37e73AHEfIb O1Kfg+YWkMyk44GQLJ4vbGRbd2XJYHCIeqdIespSLrOtjNln5Uau3HZrpKpoj/bLDgD2LuKV0O1B+ JX1B5O4g==; Received: from smtp02.smtpout.orange.fr ([80.12.242.124] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lk4Vr-00H6X4-PX for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 12:44:25 +0000 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d78 with ME id 7Qcg2500H21Fzsu03Qchxh; Fri, 21 May 2021 14:36:44 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 21 May 2021 14:36:44 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: ulf.hansson@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, wsa+renesas@sang-engineering.com, dianders@chromium.org, rmfrfs@gmail.com, cjb@laptop.org, linux-arm-kernel@lists.infradead.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] mmc: mxs-mmc: Disable the 'reg_vmmc' regulator when needed Date: Fri, 21 May 2021 14:36:39 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_054423_999540_DBC37D56 X-CRM114-Status: GOOD ( 11.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 'reg_vmmc' regulator is never disabled. Neither in the error handling of the probe, nor in the remove function. Add a managed action to do the required clean-up before a 'regulator_put()' call. Fixes: 4dc5a79f1350 ("mmc: mxs-mmc: enable regulator for mmc slot") Signed-off-by: Christophe JAILLET --- drivers/mmc/host/mxs-mmc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 947581de7860..b043d53dd728 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -552,6 +552,13 @@ static const struct of_device_id mxs_mmc_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids); +static void regulator_disable_action(void *_data) +{ + struct regulator *regulator = _data; + + regulator_disable(regulator); +} + static int mxs_mmc_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -591,6 +598,10 @@ static int mxs_mmc_probe(struct platform_device *pdev) "Failed to enable vmmc regulator: %d\n", ret); goto out_mmc_free; } + ret = devm_add_action_or_reset(&pdev->dev, + regulator_disable_action, reg_vmmc); + if (ret) + goto out_mmc_free; } ssp->clk = devm_clk_get(&pdev->dev, NULL);