From patchwork Thu Aug 31 04:40:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9931125 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 9EC61602F0 for ; Thu, 31 Aug 2017 04:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99F752881C for ; Thu, 31 Aug 2017 04:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8ED632881D; Thu, 31 Aug 2017 04:42:46 +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=-1.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF2828829 for ; Thu, 31 Aug 2017 04:42:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B744026725C; Thu, 31 Aug 2017 06:41:51 +0200 (CEST) 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 B30A2267261; Thu, 31 Aug 2017 06:41:50 +0200 (CEST) Received: from smtp.smtpout.orange.fr (smtp07.smtpout.orange.fr [80.12.242.129]) by alsa0.perex.cz (Postfix) with ESMTP id 159DD26723F for ; Thu, 31 Aug 2017 06:41:48 +0200 (CEST) Received: from localhost.localdomain ([86.196.182.67]) by mwinf5d66 with ME id 3ghj1w00A1TfVo603ghjYm; Thu, 31 Aug 2017 06:41:48 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 31 Aug 2017 06:41:48 +0200 X-ME-IP: 86.196.182.67 From: Christophe JAILLET To: perex@perex.cz, tiwai@suse.com, arvind.yadav.cs@gmail.com, nicolas.ferre@microchip.com, broonie@kernel.org, garsilva@embeddedor.com, andriy.shevchenko@linux.intel.com, bhumirks@gmail.com Date: Thu, 31 Aug 2017 06:40:42 +0200 Message-Id: <20170831044042.23306-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Cc: Christophe JAILLET , alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ALSA: ac97c: Fix an error handling path in 'atmel_ac97c_probe()' 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP If 'clk_prepare_enable()' fails, we must release some resources before returning. Add a new label in the existing error handling path and 'goto' there. Fixes: 260ea95cc027 ("ASoC: atmel: ac97c: Handle return value of clk_prepare_enable.") Signed-off-by: Christophe JAILLET Acked-by: Alexandre Belloni --- sound/atmel/ac97c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 30c64ab210d9..5ffefac2fa8f 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -785,7 +785,7 @@ static int atmel_ac97c_probe(struct platform_device *pdev) } retval = clk_prepare_enable(pclk); if (retval) - return retval; + goto err_prepare_enable; retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, @@ -881,6 +881,7 @@ static int atmel_ac97c_probe(struct platform_device *pdev) snd_card_free(card); err_snd_card_new: clk_disable_unprepare(pclk); +err_prepare_enable: clk_put(pclk); return retval; }