Skip to content

Commit

Permalink
ALSA: oxygen: prevent muting of nonexistent AC97 controls
Browse files Browse the repository at this point in the history
The Xonar DX does not have CD Capture controls, so we have to check that
a control actually exists before muting it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Aug 26, 2008
1 parent b8e6c91 commit 3d839e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/pci/oxygen/oxygen_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,12 @@ static int ac97_switch_get(struct snd_kcontrol *ctl,

static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
{
unsigned int priv_idx = chip->controls[control]->private_value & 0xff;
unsigned int priv_idx;
u16 value;

if (!chip->controls[control])
return;
priv_idx = chip->controls[control]->private_value & 0xff;
value = oxygen_read_ac97(chip, 0, priv_idx);
if (!(value & 0x8000)) {
oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
Expand Down

0 comments on commit 3d839e5

Please sign in to comment.