aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-07-16 10:31:04 -0400
committerTakashi Iwai <tiwai@suse.de>2014-07-16 10:32:01 -0400
commit2d9772ef653ccf2d5213603e371bbdfe7573df93 (patch)
tree4698052c0ac25b52d42d2fb75642f619a7fcf89d /sound/pci
parent6217e5ede23285ddfee10d2e4ba0cc2d4c046205 (diff)
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')
-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)
772{ 772{
773 struct pci_dev *pci = to_pci_dev(dev); 773 struct pci_dev *pci = to_pci_dev(dev);
774 struct snd_card *card = dev_get_drvdata(dev); 774 struct snd_card *card = dev_get_drvdata(dev);
775 struct azx *chip = card->private_data; 775 struct azx *chip;
776 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 776 struct hda_intel *hda;
777 struct azx_pcm *p; 777 struct azx_pcm *p;
778 778
779 if (!card)
780 return 0;
781
782 chip = card->private_data;
783 hda = container_of(chip, struct hda_intel, chip);
779 if (chip->disabled || hda->init_failed) 784 if (chip->disabled || hda->init_failed)
780 return 0; 785 return 0;
781 786
@@ -806,9 +811,14 @@ static int azx_resume(struct device *dev)
806{ 811{
807 struct pci_dev *pci = to_pci_dev(dev); 812 struct pci_dev *pci = to_pci_dev(dev);
808 struct snd_card *card = dev_get_drvdata(dev); 813 struct snd_card *card = dev_get_drvdata(dev);
809 struct azx *chip = card->private_data; 814 struct azx *chip;
810 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 815 struct hda_intel *hda;
811 816
817 if (!card)
818 return 0;
819
820 chip = card->private_data;
821 hda = container_of(chip, struct hda_intel, chip);
812 if (chip->disabled || hda->init_failed) 822 if (chip->disabled || hda->init_failed)
813 return 0; 823 return 0;
814 824
@@ -844,9 +854,14 @@ static int azx_resume(struct device *dev)
844static int azx_runtime_suspend(struct device *dev) 854static int azx_runtime_suspend(struct device *dev)
845{ 855{
846 struct snd_card *card = dev_get_drvdata(dev); 856 struct snd_card *card = dev_get_drvdata(dev);
847 struct azx *chip = card->private_data; 857 struct azx *chip;
848 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 858 struct hda_intel *hda;
849 859
860 if (!card)
861 return 0;
862
863 chip = card->private_data;
864 hda = container_of(chip, struct hda_intel, chip);
850 if (chip->disabled || hda->init_failed) 865 if (chip->disabled || hda->init_failed)
851 return 0; 866 return 0;
852 867
@@ -869,12 +884,17 @@ static int azx_runtime_suspend(struct device *dev)
869static int azx_runtime_resume(struct device *dev) 884static int azx_runtime_resume(struct device *dev)
870{ 885{
871 struct snd_card *card = dev_get_drvdata(dev); 886 struct snd_card *card = dev_get_drvdata(dev);
872 struct azx *chip = card->private_data; 887 struct azx *chip;
873 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 888 struct hda_intel *hda;
874 struct hda_bus *bus; 889 struct hda_bus *bus;
875 struct hda_codec *codec; 890 struct hda_codec *codec;
876 int status; 891 int status;
877 892
893 if (!card)
894 return 0;
895
896 chip = card->private_data;
897 hda = container_of(chip, struct hda_intel, chip);
878 if (chip->disabled || hda->init_failed) 898 if (chip->disabled || hda->init_failed)
879 return 0; 899 return 0;
880 900
@@ -910,9 +930,14 @@ static int azx_runtime_resume(struct device *dev)
910static int azx_runtime_idle(struct device *dev) 930static int azx_runtime_idle(struct device *dev)
911{ 931{
912 struct snd_card *card = dev_get_drvdata(dev); 932 struct snd_card *card = dev_get_drvdata(dev);
913 struct azx *chip = card->private_data; 933 struct azx *chip;
914 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 934 struct hda_intel *hda;
935
936 if (!card)
937 return 0;
915 938
939 chip = card->private_data;
940 hda = container_of(chip, struct hda_intel, chip);
916 if (chip->disabled || hda->init_failed) 941 if (chip->disabled || hda->init_failed)
917 return 0; 942 return 0;
918 943