aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-15 14:48:19 -0400
committerTakashi Iwai <tiwai@suse.de>2010-07-16 02:30:08 -0400
commit315e8f7501ad929acacfa94c251283e837f281ed (patch)
treeeafd010d60ce0eb5665eb14c8117bde8aa9b3112 /sound
parent1d8c1100fbf956b9c5994077a4d3c6490c23e087 (diff)
ALSA: asihpi: fix sign bug
bytes_per_sec is unsigned, so if snd_pcm_format_width() return error we would not see it. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/asihpi/asihpi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 91218f77217f..c80b0b863c54 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -460,6 +460,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
460 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 460 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
461 int err; 461 int err;
462 u16 format; 462 u16 format;
463 int width;
463 unsigned int bytes_per_sec; 464 unsigned int bytes_per_sec;
464 465
465 print_hwparams(params); 466 print_hwparams(params);
@@ -512,9 +513,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
512 dpcm->hpi_buffer_attached); 513 dpcm->hpi_buffer_attached);
513 } 514 }
514 bytes_per_sec = params_rate(params) * params_channels(params); 515 bytes_per_sec = params_rate(params) * params_channels(params);
515 bytes_per_sec *= snd_pcm_format_width(params_format(params)); 516 width = snd_pcm_format_width(params_format(params));
517 bytes_per_sec *= width;
516 bytes_per_sec /= 8; 518 bytes_per_sec /= 8;
517 if (bytes_per_sec <= 0) 519 if (width < 0 || bytes_per_sec == 0)
518 return -EINVAL; 520 return -EINVAL;
519 521
520 dpcm->bytes_per_sec = bytes_per_sec; 522 dpcm->bytes_per_sec = bytes_per_sec;