Skip to content

Commit

Permalink
ASoC: soc-core: fix crash when removing not instantiated card
Browse files Browse the repository at this point in the history
If the card was not instantiated in snd_soc_instantiate_card, calling
soc-remove will crash because some of codec, cpu_dai and card .remove
methods are called twice.
Fix this by returning from soc_remove immediately.

Signed-off-by: Mike Rapoport <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Mike Rapoport authored and broonie committed May 11, 2009
1 parent 97a775c commit 914dc18
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,9 @@ static int soc_remove(struct platform_device *pdev)
struct snd_soc_platform *platform = card->platform;
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;

if (!card->instantiated)
return 0;

run_delayed_work(&card->delayed_work);

if (platform->remove)
Expand Down

0 comments on commit 914dc18

Please sign in to comment.