summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-03-29 14:30:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-07 15:47:42 +0300
commit3acbf473a885dda9fdca16b95dd00c64e1e9372e (patch)
tree3e8bfc2c29e9c01e16f563ca577ff51e3be81893 /sound/pci
parent65f92e40cc6d55b345f3d3de2f1b62cff1758f30 (diff)
downloadlinux-3acbf473a885dda9fdca16b95dd00c64e1e9372e.tar.xz
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: f5dac54d9d93 ("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>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_intel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index d9a2857b4c33..ebb1ee69dd0c 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1022,6 +1022,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);
@@ -1039,6 +1042,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;