ASoC: soc-core: fix crash when removing not instantiated card
authorMike Rapoport <mike@compulab.co.il>
Mon, 11 May 2009 10:04:55 +0000 (13:04 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 11 May 2009 18:01:51 +0000 (19:01 +0100)
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 <mike@compulab.co.il>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c

index 99712f6..1cd149b 100644 (file)
@@ -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)