aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-03-02 11:45:50 +0100
committerTakashi Iwai <tiwai@suse.de>2009-03-02 14:49:58 +0100
commiteab2b553c3d3ed20698c4a9c7e049a60b804e2f5 (patch)
treea024f65cc06de0de4a07271135cfb6c7d1ec3864 /sound
parentf3990e610a157e9c36af85a75bc66260dff31f40 (diff)
sound: usb-audio: fix rules check for 32-channel devices
When storing the channel numbers used by a format, and if the device happens to support 32 channels, the code would try to store 1<<32 in a 32-bit value. Since no valid format can have zero channels, we can use 1<<(channels-1) instead of 1<<channels so that all the channel numbers that we test for fit into 32 bits. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/usbaudio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 2b24496ddec..f853b627cf4 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1783,7 +1783,7 @@ static int check_hw_params_convention(struct snd_usb_substream *subs)
if (rates[f->format] && rates[f->format] != f->rates)
goto __out;
}
- channels[f->format] |= (1 << f->channels);
+ channels[f->format] |= 1 << (f->channels - 1);
rates[f->format] |= f->rates;
/* needs knot? */
if (f->rates & SNDRV_PCM_RATE_KNOT)
@@ -1810,7 +1810,7 @@ static int check_hw_params_convention(struct snd_usb_substream *subs)
continue;
for (i = 0; i < 32; i++) {
if (f->rates & (1 << i))
- channels[i] |= (1 << f->channels);
+ channels[i] |= 1 << (f->channels - 1);
}
}
cmaster = 0;