From patchwork Sun Nov 19 14:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10065145 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 7D647602CB for ; Sun, 19 Nov 2017 14:09:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6884628E1A for ; Sun, 19 Nov 2017 14:09:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C69728F0C; Sun, 19 Nov 2017 14:09:06 +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, 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 41CD728E1A for ; Sun, 19 Nov 2017 14:09:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 83746267426; Sun, 19 Nov 2017 15:09: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 272D0267428; Sun, 19 Nov 2017 15:08:59 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.15.4]) by alsa0.perex.cz (Postfix) with ESMTP id 0A3AB267403 for ; Sun, 19 Nov 2017 15:08:55 +0100 (CET) Received: from [192.168.1.3] ([92.225.173.18]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5fxo-1f4wUs1Fdo-00xbM2; Sun, 19 Nov 2017 15:08:42 +0100 To: alsa-devel@alsa-project.org, Jaroslav Kysela , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Sangbeom Kim , Sylwester Nawrocki , Takashi Iwai From: SF Markus Elfring Message-ID: <8c4e72ae-7606-a4c8-3d53-42364d7edbb2@users.sourceforge.net> Date: Sun, 19 Nov 2017 15:08:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:oUEeFhX/QBRWU1k7w3iLff41AKLyWnanBtmgclwPWJBHw0B2HQ/ 8ail3hZgSU92rn72EJovmtY0wy+IdUx721LnbUdoSrL4Lo2DdMcua5X11uoU++47vEuMdWO VoHxJAGsi4EG9nqD7VG/kjikGpym/ks0cfU7XWFFm+994e2mTBmgRDdKC5IKozsXEU2x4hL 33zWFBnj5hvJx0KHHQgqA== X-UI-Out-Filterresults: notjunk:1; V01:K0:iWdWeHt9U2M=:C3nFssIO+GdFvmnhUvKqo0 sCq9/SeQ5tZUZpNH5rEX/yvBOIXXRTpVV+K//+9cOQBUwJhsxn5/vpuEGtD8xBdiT41Z/NBzl NdehE8AgiYVNWiNWr7p8WwfXzTE9ftbEhL7JiqLBL6ZfIrJE5eq28JCJXeXbc4iMUTRldVeuH 9VI+btJSOO/Oi66+afMPCXWRndH+rlqirmCJ+EZO2Ox8Qb04g5Vt0mXrxRtIoMvmMGkKO8fhl 7uRfWd58jYcjRZlKrCkQgK/zZQMYJwqJzCstlnLs+uBBoUa/FJENsD7U/XAbACTIJJE3lq+nH GLMOMnpOeuYSpIiiXOL6GupMFb9TK1WutjyvO55ujA4fzMkZz0yz9cOupW5QOLYlNlmpZ6WLo TFWIvZpkqRO/kWvQdH3jQblYuDzUr7/oo5sGiX0AM/V5SVci0DIHiBcCSrtoCMD2wL+t4Z3q0 87rjOa1KTtGez9XE1JL0r9LHLTedBeMSz+zsrbEj8yFMV7VNdw9mROoAgqlAg/VNShSbFNDR9 bB45v937UdbQkJV8PdM81mBNxMYatambzhepWH6EJqipPsIZOA3iegocaXq7iYQ/H1jlG5D0z OUyz/oQ0LOnVbaE70Yr6gazdvv/cTxK51FGu2Lb8lVFTOJ5Uwq17k6Sdl97rESvvvwDkRuiqv /sASh1wWYEXYJ/+NBS7I+f4eSL/TeEB6W2fkWBR3ykLtjEV3AwtLa7OhEBsCqI1n7gi0jjypt ERjIXA6eXRSL8EP/ZE6M2MMf2r/0o4jE239AbVLCUbZz1S1nRqlmdrXclQKANXVJGDhpt4TQ3 CSiS3LTV8e+GwoTur3LkNBsvJuo9KLlpNHdEQoBUJewRENWVIg= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH] ASoC: bells: Use common error handling code in bells_set_bias_level_post() 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 From: Markus Elfring Date: Sun, 19 Nov 2017 15:00:22 +0100 * Add a jump target so that a specific error message is stored only once at the end of this function implementation. * Replace two calls of the macro "pr_err" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/soc/samsung/bells.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c index 34deba461ae1..fc9a71523b3e 100644 --- a/sound/soc/samsung/bells.c +++ b/sound/soc/samsung/bells.c @@ -120,18 +120,14 @@ static int bells_set_bias_level_post(struct snd_soc_card *card, switch (level) { case SND_SOC_BIAS_STANDBY: ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 0, 0, 0); - if (ret < 0) { - pr_err("Failed to stop FLL: %d\n", ret); - return ret; - } + if (ret < 0) + goto report_failure; if (bells->asyncclk_rate) { ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, 0, 0, 0); - if (ret < 0) { - pr_err("Failed to stop FLL: %d\n", ret); - return ret; - } + if (ret < 0) + goto report_failure; } break; @@ -142,6 +138,10 @@ static int bells_set_bias_level_post(struct snd_soc_card *card, dapm->bias_level = level; return 0; + +report_failure: + pr_err("Failed to stop FLL: %d\n", ret); + return ret; } static int bells_late_probe(struct snd_soc_card *card)