Commit 3e14b50d authored by Takashi Iwai's avatar Takashi Iwai

ALSA: sb - Fix wrong assertions

snd_assert() in save_mixer() and restore_mixer() in sb_mixer.c is
just wrong.  The debug code wasn't tested at all, obviously...
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 44e05177
...@@ -925,7 +925,7 @@ static unsigned char als4000_saved_regs[] = { ...@@ -925,7 +925,7 @@ static unsigned char als4000_saved_regs[] = {
static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
{ {
unsigned char *val = chip->saved_regs; unsigned char *val = chip->saved_regs;
snd_assert(num_regs > ARRAY_SIZE(chip->saved_regs), return); snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return);
for (; num_regs; num_regs--) for (; num_regs; num_regs--)
*val++ = snd_sbmixer_read(chip, *regs++); *val++ = snd_sbmixer_read(chip, *regs++);
} }
...@@ -933,7 +933,7 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) ...@@ -933,7 +933,7 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
{ {
unsigned char *val = chip->saved_regs; unsigned char *val = chip->saved_regs;
snd_assert(num_regs > ARRAY_SIZE(chip->saved_regs), return); snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return);
for (; num_regs; num_regs--) for (; num_regs; num_regs--)
snd_sbmixer_write(chip, *regs++, *val++); snd_sbmixer_write(chip, *regs++, *val++);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment