mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-05 08:35:24 +07:00
ALSA: hda: Add missing sanity checks in PM prepare/complete callbacks
commit 66affb7bb0dc0905155a1b2475261aa704d1ddb5 upstream.
The recently added PM prepare and complete callbacks don't have the
sanity check whether the card instance has been properly initialized,
which may potentially lead to Oops.
This patch adds the azx_is_pm_ready() call in each place
appropriately like other PM callbacks.
Fixes: f5dac54d9d
("ALSA: hda: Separate runtime and system suspend")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210329113059.25035-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b3116cda4e
commit
6d91f3afb6
@ -1023,6 +1023,9 @@ static int azx_prepare(struct device *dev)
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct azx *chip;
|
||||
|
||||
if (!azx_is_pm_ready(card))
|
||||
return 0;
|
||||
|
||||
chip = card->private_data;
|
||||
chip->pm_prepared = 1;
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
@ -1040,6 +1043,9 @@ static void azx_complete(struct device *dev)
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct azx *chip;
|
||||
|
||||
if (!azx_is_pm_ready(card))
|
||||
return;
|
||||
|
||||
chip = card->private_data;
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
chip->pm_prepared = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user