aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-03-30 14:26:38 +0900
committerMark Brown <broonie@kernel.org>2021-03-31 18:02:23 +0100
commit5fa7553dcd83c576c589fd3e617dc599e4fe15dc (patch)
tree4e01d1028fe12407b39c3adf6b8fb9bdd73b8dc8 /sound/soc/soc-core.c
parentASoC: soc-core: add comment for rtd freeing (diff)
downloadwireguard-linux-5fa7553dcd83c576c589fd3e617dc599e4fe15dc.tar.xz
wireguard-linux-5fa7553dcd83c576c589fd3e617dc599e4fe15dc.zip
ASoC: soc-core: use device_unregister() if rtd allocation failed
Because soc_free_pcm_runtime(rtd) checks rtd pointer and freeing rtd->xxx, it doesn't work correctly in case of rtd allocation failed. We need to use device_unregister(dev) in such case. This patch fixup it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r1jxxldd.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 88694746dc11..236e075b9e57 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -470,8 +470,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
dai_link->num_codecs +
dai_link->num_platforms),
GFP_KERNEL);
- if (!rtd)
- goto free_rtd;
+ if (!rtd) {
+ device_unregister(dev);
+ return NULL;
+ }
rtd->dev = dev;
INIT_LIST_HEAD(&rtd->list);