summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-07-16 16:31:04 +0200
committerTakashi Iwai <tiwai@suse.de>2014-07-16 16:32:01 +0200
commit2d9772ef653ccf2d5213603e371bbdfe7573df93 (patch)
tree4698052c0ac25b52d42d2fb75642f619a7fcf89d /sound/pci/hda/hda_intel.c
parentALSA: compress: fix an integer overflow check (diff)
downloadlinux-2d9772ef653ccf2d5213603e371bbdfe7573df93.tar.xz
linux-2d9772ef653ccf2d5213603e371bbdfe7573df93.zip
ALSA: hda - Add NULL check to all PM ops in hda_intel.c
Since devptr can be NULL due to asynchronous probe, all PM ops should have NULL checks at the beginning. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 8edcee5f034d..387fc73a5c89 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -772,10 +772,15 @@ static int azx_suspend(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
- struct azx *chip = card->private_data;
- struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct azx *chip;
+ struct hda_intel *hda;
struct azx_pcm *p;
+ if (!card)
+ return 0;
+
+ chip = card->private_data;
+ hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
return 0;
@@ -806,9 +811,14 @@ static int azx_resume(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
- struct azx *chip = card->private_data;
- struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct azx *chip;
+ struct hda_intel *hda;
+ if (!card)
+ return 0;
+
+ chip = card->private_data;
+ hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
return 0;
@@ -844,9 +854,14 @@ static int azx_resume(struct device *dev)
static int azx_runtime_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
- struct azx *chip = card->private_data;
- struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct azx *chip;
+ struct hda_intel *hda;
+ if (!card)
+ return 0;
+
+ chip = card->private_data;
+ hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
return 0;
@@ -869,12 +884,17 @@ static int azx_runtime_suspend(struct device *dev)
static int azx_runtime_resume(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
- struct azx *chip = card->private_data;
- struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct azx *chip;
+ struct hda_intel *hda;
struct hda_bus *bus;
struct hda_codec *codec;
int status;
+ if (!card)
+ return 0;
+
+ chip = card->private_data;
+ hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
return 0;
@@ -910,9 +930,14 @@ static int azx_runtime_resume(struct device *dev)
static int azx_runtime_idle(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
- struct azx *chip = card->private_data;
- struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct azx *chip;
+ struct hda_intel *hda;
+
+ if (!card)
+ return 0;
+ chip = card->private_data;
+ hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
return 0;