[alsa-devel] [PATCH] ASoC: core: On resume also check the soc device state
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 ---
The soc_susbend code is checking, if the soc device is properly initialized, but on soc_resume the check is missing, and it is unlikely that the soc device is actually initialized between these two calls. This fixes a crash, when doing suspend on a system where a soc device is not properly initialized. The crash happens on resume path, since the suspend has been protected against such a scenario.
sound/soc/soc-core.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e1c0336..a03bac9 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -963,6 +963,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
On Mon, 2010-02-22 at 13:27 +0200, Peter Ujfalusi wrote:
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
The soc_susbend code is checking, if the soc device is properly initialized, but on soc_resume the check is missing, and it is unlikely that the soc device is actually initialized between these two calls. This fixes a crash, when doing suspend on a system where a soc device is not properly initialized. The crash happens on resume path, since the suspend has been protected against such a scenario.
sound/soc/soc-core.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
On Mon, Feb 22, 2010 at 11:32:12AM +0000, Liam Girdwood wrote:
On Mon, 2010-02-22 at 13:27 +0200, Peter Ujfalusi wrote:
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
Applied, thanks.
participants (3)
-
Liam Girdwood
-
Mark Brown
-
Peter Ujfalusi