提交 ef1ffbe7 编写于 作者: Z Zhouyang Jia 提交者: Takashi Iwai

ALSA: fm801: add error handling for snd_ctl_add

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.
Signed-off-by: NZhouyang Jia <jiazhouyang09@gmail.com>
Acked-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 d4d5a1cd
......@@ -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_multi[i], chip));
if (err < 0)
return err;
}
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册