From f7c4842abfa1a219554a3ffd8c317e8fdd979bec Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 17 May 2019 10:21:12 +0900 Subject: ASoC: soc-dpm: fixup DAI active unbalance snd_soc_dai_link_event() is updating snd_soc_dai :: active, but it is unbalance. It counts up if it has startup callback. case SND_SOC_DAPM_PRE_PMU: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... if (source->driver->ops->startup) { ... => source->active++; } ... } ... But, always counts down case SND_SOC_DAPM_PRE_PMD: ... snd_soc_dapm_widget_for_each_source_path(w, path) { ... => source->active--; ... } This patch always counts up when SND_SOC_DAPM_PRE_PMD. Signed-off-by: Kuninori Morimoto Reviewed-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/soc/soc-dapm.c') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 65ee0bb5dd0b..62e27defce56 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3828,8 +3828,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - source->active++; } + source->active++; ret = soc_dai_hw_params(&substream, params, source); if (ret < 0) goto out; @@ -3850,8 +3850,8 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ret); goto out; } - sink->active++; } + sink->active++; ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out; -- cgit v1.2.3 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