提交 e3509ff0 编写于 作者: D Daniel Mack 提交者: Mark Brown

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: NDaniel Mack <daniel@caiaq.de>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 d08664fd
......@@ -628,6 +628,12 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
struct snd_soc_codec *codec = card->codec;
int i;
/* If the initialization of this soc device failed, there is no codec
* associated with it. Just bail out in this case.
*/
if (!codec)
return 0;
/* Due to the resume being scheduled into a workqueue we could
* suspend before that's finished - wait for it to complete.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册