aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-03-17 04:59:32 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:25 -0400
commit5a220c868e395bc3662d13ad4c2a18769075af54 (patch)
tree80867804129e53135e5f18970a18ae8c27c0f28e /sound/usb/usbaudio.c
parent841b23d4d7b554c8d74fc9c34a701f85abc04875 (diff)
[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>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c9
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)
1762 1762
1763 channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); 1763 channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
1764 rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); 1764 rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
1765 if (!channels || !rates) 1765 if (!channels || !rates) {
1766 err = -ENOMEM;
1766 goto __out; 1767 goto __out;
1768 }
1767 1769
1768 list_for_each(p, &subs->fmt_list) { 1770 list_for_each(p, &subs->fmt_list) {
1769 struct audioformat *f; 1771 struct audioformat *f;
@@ -1916,7 +1918,10 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
1916 1000 * MIN_PACKS_URB, 1918 1000 * MIN_PACKS_URB,
1917 /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); 1919 /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX);
1918 1920
1919 if (check_hw_params_convention(subs)) { 1921 err = check_hw_params_convention(subs);
1922 if (err < 0)
1923 return err;
1924 else if (err) {
1920 hwc_debug("setting extra hw constraints...\n"); 1925 hwc_debug("setting extra hw constraints...\n");
1921 if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 1926 if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
1922 hw_rule_rate, subs, 1927 hw_rule_rate, subs,