diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-03-17 11:59:32 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 14:00:25 +0400 |
commit | 5a220c868e395bc3662d13ad4c2a18769075af54 (patch) | |
tree | 80867804129e53135e5f18970a18ae8c27c0f28e | |
parent | 841b23d4d7b554c8d74fc9c34a701f85abc04875 (diff) | |
download | linux-5a220c868e395bc3662d13ad4c2a18769075af54.tar.xz |
[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: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/usbaudio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index f48838a078cb..5c40c031dd57 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1762,8 +1762,10 @@ static int check_hw_params_convention(struct snd_usb_substream *subs) channels = 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; + } list_for_each(p, &subs->fmt_list) { struct audioformat *f; @@ -1916,7 +1918,10 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre 1000 * MIN_PACKS_URB, /*(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"); if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, hw_rule_rate, subs, |