Skip to content

Commit

Permalink
ASoC: fix NULL pointer dereference in soc_suspend()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Mack authored and Mark Brown committed Jun 4, 2009
1 parent d08664f commit e3509ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit e3509ff

Please sign in to comment.