mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
ALSA: opl3sa2 - Fix NULL dereference when suspending snd_opl3sa2
Fix the OOPS during a opl3sa2 card suspend and resume if the driver is loaded but the card is not found. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
041b62374c
commit
dde332b660
@ -550,21 +550,27 @@ static int __devinit snd_opl3sa2_mixer(struct snd_card *card)
|
||||
#ifdef CONFIG_PM
|
||||
static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state)
|
||||
{
|
||||
struct snd_opl3sa2 *chip = card->private_data;
|
||||
if (card) {
|
||||
struct snd_opl3sa2 *chip = card->private_data;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->wss->suspend(chip->wss);
|
||||
/* power down */
|
||||
snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
chip->wss->suspend(chip->wss);
|
||||
/* power down */
|
||||
snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_opl3sa2_resume(struct snd_card *card)
|
||||
{
|
||||
struct snd_opl3sa2 *chip = card->private_data;
|
||||
struct snd_opl3sa2 *chip;
|
||||
int i;
|
||||
|
||||
if (!card)
|
||||
return 0;
|
||||
|
||||
chip = card->private_data;
|
||||
/* power up */
|
||||
snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user