From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: jiazhouyang09@gmail.com, "Émeric MASCHINO" <emeric.maschino@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Bhumika Goyal <bhumirks@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: fm801: add error handling for snd_ctl_add
Date: Mon, 11 Jun 2018 11:49:56 +0300 [thread overview]
Message-ID: <520e80a8b8de0f532e8dd3ee15af9efbc748dd9a.camel@linux.intel.com> (raw)
In-Reply-To: <1528704248-33818-1-git-send-email-jiazhouyang09@gmail.com>
On Mon, 2018-06-11 at 16:04 +0800, jiazhouyang09@gmail.com wrote:
> When snd_ctl_add fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling snd_ctl_add.
>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Though I can't test this (I have FM-only card). Last person who would
able to test was Émeric (Cc'ed).
> Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
> ---
> sound/pci/fm801.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
> index 73a67bc..e3fb9c6 100644
> --- a/sound/pci/fm801.c
> +++ b/sound/pci/fm801.c
> @@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801 *chip)
> if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97,
> &chip->ac97_sec)) < 0)
> return err;
> }
> - for (i = 0; i < FM801_CONTROLS; i++)
> - snd_ctl_add(chip->card,
> snd_ctl_new1(&snd_fm801_controls[i], chip));
> + for (i = 0; i < FM801_CONTROLS; i++) {
> + err = snd_ctl_add(chip->card,
> + snd_ctl_new1(&snd_fm801_controls[i], chip));
> + if (err < 0)
> + return err;
> + }
> if (chip->multichannel) {
> - for (i = 0; i < FM801_CONTROLS_MULTI; i++)
> - snd_ctl_add(chip->card,
> snd_ctl_new1(&snd_fm801_controls_multi[i], chip));
> + for (i = 0; i < FM801_CONTROLS_MULTI; i++) {
> + err = snd_ctl_add(chip->card,
> + snd_ctl_new1(&snd_fm801_controls_mult
> i[i], chip));
> + if (err < 0)
> + return err;
> + }
> }
> return 0;
> }
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2018-06-11 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 8:04 Zhouyang Jia
2018-06-11 8:49 ` Andy Shevchenko [this message]
2018-06-11 13:24 ` Takashi Iwai
2018-06-20 19:39 ` Émeric MASCHINO
2018-06-21 0:34 ` Andy Shevchenko
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=520e80a8b8de0f532e8dd3ee15af9efbc748dd9a.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=bhumirks@gmail.com \
--cc=emeric.maschino@gmail.com \
--cc=jiazhouyang09@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--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
Powered by JetHome