From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>,
Krzysztof Kozlowski <krzk@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Sangbeom Kim <sbkim73@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Takashi Iwai <tiwai@suse.com>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] ASoC: bells: Use common error handling code in bells_set_bias_level_post()
Date: Sun, 19 Nov 2017 14:08:39 +0000 [thread overview]
Message-ID: <8c4e72ae-7606-a4c8-3d53-42364d7edbb2@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
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)
--
2.15.0
next reply other threads:[~2017-11-19 14:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 14:08 SF Markus Elfring [this message]
2017-11-20 7:38 ` [PATCH] ASoC: bells: Use common error handling code in bells_set_bias_level_post() Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c4e72ae-7606-a4c8-3d53-42364d7edbb2@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=s.nawrocki@samsung.com \
--cc=sbkim73@samsung.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox