diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-05-27 16:51:34 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-19 08:00:04 +0200 |
commit | 5d303f97212527788caf03df1802da85f6c08ee9 (patch) | |
tree | 4f02c39d63f3679facb94ee42ed31030e9d2c6e4 /sound | |
parent | 5f3b468a5dc69967930a1a7d6c3d7c3349be866a (diff) | |
download | linux-stable-5d303f97212527788caf03df1802da85f6c08ee9.tar.gz linux-stable-5d303f97212527788caf03df1802da85f6c08ee9.tar.bz2 linux-stable-5d303f97212527788caf03df1802da85f6c08ee9.zip |
ASoC: soc-core: fixup references at soc_cleanup_card_resources()
commit 29040d1ac569606fece70966179de272cfc0d4db upstream.
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 <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 7 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index fe99b02bbf17..a7b4fab92f26 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -228,7 +228,10 @@ static void soc_init_card_debugfs(struct snd_soc_card *card) static void soc_cleanup_card_debugfs(struct snd_soc_card *card) { + if (!card->debugfs_card_root) + return; debugfs_remove_recursive(card->debugfs_card_root); + card->debugfs_card_root = NULL; } static void snd_soc_debugfs_init(void) @@ -2034,8 +2037,10 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) static int soc_cleanup_card_resources(struct snd_soc_card *card) { /* free the ALSA card at first; this syncs with pending operations */ - if (card->snd_card) + if (card->snd_card) { snd_card_free(card->snd_card); + card->snd_card = NULL; + } /* remove and free each DAI */ soc_remove_dai_links(card); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 0382a47b30bd..5d9d7678e4fa 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 |