提交 5a220c86 编写于 作者: T Takashi Iwai

[ALSA] usb-audio - Add a proper error check

The error in check_hw_params_convention() has to be checked and
handled properly.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 841b23d4
...@@ -1762,8 +1762,10 @@ static int check_hw_params_convention(struct snd_usb_substream *subs) ...@@ -1762,8 +1762,10 @@ static int check_hw_params_convention(struct snd_usb_substream *subs)
channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
if (!channels || !rates) if (!channels || !rates) {
err = -ENOMEM;
goto __out; goto __out;
}
list_for_each(p, &subs->fmt_list) { list_for_each(p, &subs->fmt_list) {
struct audioformat *f; struct audioformat *f;
...@@ -1916,7 +1918,10 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre ...@@ -1916,7 +1918,10 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
1000 * MIN_PACKS_URB, 1000 * MIN_PACKS_URB,
/*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX);
if (check_hw_params_convention(subs)) { err = check_hw_params_convention(subs);
if (err < 0)
return err;
else if (err) {
hwc_debug("setting extra hw constraints...\n"); hwc_debug("setting extra hw constraints...\n");
if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
hw_rule_rate, subs, hw_rule_rate, subs,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册