From 29040d1ac569606fece70966179de272cfc0d4db Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 27 May 2019 16:51:34 +0900 Subject: ASoC: soc-core: fixup references at soc_cleanup_card_resources() commit 53e947a0e1f7 ("ASoC: soc-core: merge card resources cleanup method") merged cleanup method of snd_soc_instantiate_card() and soc_cleanup_card_resources(). But, after this commit, if user uses unbind/bind to Component factor drivers, Kernel might indicates refcount error at soc_cleanup_card_resources(). The 1st reason is card->snd_card is still exist even though snd_card_free() was called, but it is already cleaned. We need to set NULL to it. 2nd is card->dapm and card create debugfs, but its dentry is still exist even though it was removed. We need to set NULL to it. Fixes: 53e947a0e1f7 ("ASoC: soc-core: merge card resources cleanup method") Cc: stable@vger.kernel.org # for v5.1 Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound/soc/soc-dapm.c') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 62e27defce56..5fc57af9cb6f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2192,7 +2192,10 @@ static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) { + if (!dapm->debugfs_dapm) + return; debugfs_remove_recursive(dapm->debugfs_dapm); + dapm->debugfs_dapm = NULL; } #else -- cgit v1.2.3-59-g8ed1b