Skip to contentSkip to conversation

ASoC: soc-core: fix crash when removing not instantiated card

PATCH Applied Mike Rapoport 2 participants 2 messages May 11, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 sound/soc/soc-core.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/soc/soc-core.c +3 -0
index 99712f6..1cd149b 100644
@@ -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)
Signature · 1 line
1.5.6.4
Applied
#1 lore raw
Quoted 6 lines · Mike Rapoport

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.

Applied, thanks.