Skip to content

Commit

Permalink
ALSA: 6fire - Fix signedness bug
Browse files Browse the repository at this point in the history
Fixed remaining issues of the signedness bug discovered by Dan Carpenter.
A check was remaining that tests if unsigned rt->rate is >= 0.
Changed that so that rt->rate now consistently uses ARRAY_SIZE(rates)
as invalid rate value and not -1.

Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Torsten Schenk authored and Takashi Iwai committed Jun 16, 2011
1 parent e72888e commit 0ec5258
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/usb/6fire/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ static int usb6fire_pcm_open(struct snd_pcm_substream *alsa_sub)
alsa_rt->hw = pcm_hw;

if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (rt->rate >= 0)
if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = OUT_N_CHANNELS;
sub = &rt->playback;
} else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) {
if (rt->rate >= 0)
if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = IN_N_CHANNELS;
sub = &rt->capture;
Expand Down

0 comments on commit 0ec5258

Please sign in to comment.