aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers
diff options
context:
space:
mode:
authorRoel Kluin <12o3l@tiscali.nl>2008-04-16 19:30:30 +0200
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:38 +0200
commit369b240d6391aef41d376c9e8769fd939c7c6c4d (patch)
treec37500db8e4186bde3743b8ea005708bd40242c6 /sound/drivers
parent7943a8aba93ab439bdfbd9b92221720a4a4d8153 (diff)
downloadkernel_samsung_smdk4412-369b240d6391aef41d376c9e8769fd939c7c6c4d.zip
kernel_samsung_smdk4412-369b240d6391aef41d376c9e8769fd939c7c6c4d.tar.gz
kernel_samsung_smdk4412-369b240d6391aef41d376c9e8769fd939c7c6c4d.tar.bz2
[ALSA] sound/drivers/dummy.c: fix negative snd_pcm_format_width() check
bps is unsigned, a negative snd_pcm_format_width() return value is not noticed Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers')
-rw-r--r--sound/drivers/dummy.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 83ac498..4e4c69e 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -230,13 +230,14 @@ static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dummy_pcm *dpcm = runtime->private_data;
- unsigned int bps;
+ int bps;
+
+ bps = snd_pcm_format_width(runtime->format) * runtime->rate *
+ runtime->channels / 8;
- bps = runtime->rate * runtime->channels;
- bps *= snd_pcm_format_width(runtime->format);
- bps /= 8;
if (bps <= 0)
return -EINVAL;
+
dpcm->pcm_bps = bps;
dpcm->pcm_hz = HZ;
dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream);