From: Mike Rapoport Date: Mon, 11 May 2009 10:04:55 +0000 (+0300) Subject: ASoC: soc-core: fix crash when removing not instantiated card X-Git-Tag: v2.6.30-rc6~7^2^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=914dc18255e430ceabb10b57394e01814c69c5cd;p=thirdparty%2Fkernel%2Flinux.git ASoC: soc-core: fix crash when removing not instantiated card 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 99712f652d0d4..1cd149b9ce69e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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)