diff options
author | Daniel Mack <daniel@caiaq.de> | 2009-06-03 11:44:49 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-06-04 08:24:08 -0400 |
commit | e3509ff0fb9df53e45cd68488e3b463a80455db7 (patch) | |
tree | 9d13f9747af6107ca194e1be142db2a7041f5c18 /sound/soc | |
parent | d08664fdb50795b29cf70b0269ea02f7248e76c3 (diff) |
ASoC: fix NULL pointer dereference in soc_suspend()
In case the initalization of an soc_device failed, there is no codec
associated with it. soc_suspend() will still dereference the pointer
and cause an Ooops when entering the sleep mode.
This happens on our board with a multi-target kernel image when booted
on a machine without audio circuits.
This patch makes the code bail out very early in this special case.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | 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 4aa8e2d35061..3f44150d8e30 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -628,6 +628,12 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
628 | struct snd_soc_codec *codec = card->codec; | 628 | struct snd_soc_codec *codec = card->codec; |
629 | int i; | 629 | int i; |
630 | 630 | ||
631 | /* If the initialization of this soc device failed, there is no codec | ||
632 | * associated with it. Just bail out in this case. | ||
633 | */ | ||
634 | if (!codec) | ||
635 | return 0; | ||
636 | |||
631 | /* Due to the resume being scheduled into a workqueue we could | 637 | /* Due to the resume being scheduled into a workqueue we could |
632 | * suspend before that's finished - wait for it to complete. | 638 | * suspend before that's finished - wait for it to complete. |
633 | */ | 639 | */ |