From patchwork Tue Dec 22 18:27:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 7906401 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F8D8BEEE5 for ; Tue, 22 Dec 2015 18:28:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1868204D2 for ; Tue, 22 Dec 2015 18:28:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 92C6B204AF for ; Tue, 22 Dec 2015 18:28:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DCF25265DC7; Tue, 22 Dec 2015 19:28:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 93FFB2659FF; Tue, 22 Dec 2015 19:28:00 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7A71A265AFF; Tue, 22 Dec 2015 19:27:59 +0100 (CET) Received: from mail1.bemta3.messagelabs.com (mail1.bemta3.messagelabs.com [195.245.230.168]) by alsa0.perex.cz (Postfix) with ESMTP id 514302659FF for ; Tue, 22 Dec 2015 19:27:52 +0100 (CET) Received: from [85.158.137.99] by server-8.bemta-3.messagelabs.com id 2B/9C-31069-82699765; Tue, 22 Dec 2015 18:27:52 +0000 X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-11.tower-217.messagelabs.com!1450808871!6843845!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21303 invoked from network); 22 Dec 2015 18:27:51 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-11.tower-217.messagelabs.com with AES128-SHA encrypted SMTP; 22 Dec 2015 18:27:51 -0000 Received: from swsrvapps-01.diasemi.com (10.20.28.141) by SW-EX-CASHUB01.diasemi.com (10.20.16.140) with Microsoft SMTP Server id 14.3.248.2; Tue, 22 Dec 2015 18:27:51 +0000 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22379) id 061213FB54; Tue, 22 Dec 2015 18:27:51 +0000 (GMT) Message-ID: <013f8a59618a9dfa74f6f983ed6ba4d7bec6a9d0.1450807642.git.Adam.Thomson.Opensource@diasemi.com> In-Reply-To: References: From: Adam Thomson Date: Tue, 22 Dec 2015 18:27:51 +0000 To: Mark Brown , Liam Girdwood , Takashi Iwai , Jaroslav Kysela , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Support Opensource Subject: [alsa-devel] [PATCH 1/6] ASoC: da7219: Disable regulators on probe() failure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP If codec probe() function fails after supplies have been enabled it should really tidy up and disable them again. This patch updates the probe function to do just that. Signed-off-by: Adam Thomson --- sound/soc/codecs/da7219.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index f238c1e..0ba714c 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1662,10 +1662,12 @@ static int da7219_probe(struct snd_soc_codec *codec) /* Check if MCLK provided */ da7219->mclk = devm_clk_get(codec->dev, "mclk"); if (IS_ERR(da7219->mclk)) { - if (PTR_ERR(da7219->mclk) != -ENOENT) - return PTR_ERR(da7219->mclk); - else + if (PTR_ERR(da7219->mclk) != -ENOENT) { + ret = PTR_ERR(da7219->mclk); + goto err_disable_reg; + } else { da7219->mclk = NULL; + } } /* Default PC counter to free-running */ @@ -1693,7 +1695,16 @@ static int da7219_probe(struct snd_soc_codec *codec) snd_soc_write(codec, DA7219_TONE_GEN_CYCLES, DA7219_BEEP_CYCLES_MASK); /* Initialise AAD block */ - return da7219_aad_init(codec); + ret = da7219_aad_init(codec); + if (ret) + goto err_disable_reg; + + return 0; + +err_disable_reg: + regulator_bulk_disable(DA7219_NUM_SUPPLIES, da7219->supplies); + + return ret; } static int da7219_remove(struct snd_soc_codec *codec)