ASoC: core: On resume also check the soc device state
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Mon, 22 Feb 2010 11:27:13 +0000 (13:27 +0200)
committer黄涛 <huangtao@rock-chips.com>
Tue, 25 Jan 2011 12:05:54 +0000 (20:05 +0800)
Check the card->codec on soc_resume to detect if the soc
device is properly initialized.
If the card->codec is NULL, than do not continue the resume
operation, since the device is not initialized properly.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c

index 0a1b2f64bbee38a18947a9fa161eb922dc0f17a0..230cb888eb71202e0534287fce729a6deaf217cb 100644 (file)
@@ -774,6 +774,12 @@ static int soc_resume(struct device *dev)
        struct snd_soc_card *card = socdev->card;
        struct snd_soc_dai *cpu_dai = card->dai_link[0].cpu_dai;
 
+       /* If the initialization of this soc device failed, there is no codec
+        * associated with it. Just bail out in this case.
+        */
+       if (!card->codec)
+               return 0;
+
        /* AC97 devices might have other drivers hanging off them so
         * need to resume immediately.  Other drivers don't have that
         * problem and may take a substantial amount of time to resume