Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 914dc182 authored by Mike Rapoport's avatar Mike Rapoport Committed by Mark Brown
Browse files

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: default avatarMike Rapoport <mike@compulab.co.il>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 97a775c4
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -954,6 +954,9 @@ static int soc_remove(struct platform_device *pdev)
	struct snd_soc_platform *platform = card->platform;
	struct snd_soc_platform *platform = card->platform;
	struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
	struct snd_soc_codec_device *codec_dev = socdev->codec_dev;


	if (!card->instantiated)
		return 0;

	run_delayed_work(&card->delayed_work);
	run_delayed_work(&card->delayed_work);


	if (platform->remove)
	if (platform->remove)