diff options
author | Mark Brown <broonie@kernel.org> | 2021-04-01 10:25:12 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-04-01 10:25:12 +0100 |
commit | 73935e931c945b019bde312a99f1b43a0a783fca (patch) | |
tree | 9c236c509ec9a72afaefaa35478eaa08f8581404 | |
parent | 9c0da2935eba3dc48ed19c8ca30e838a68b93ff3 (diff) | |
parent | 5fa7553dcd83c576c589fd3e617dc599e4fe15dc (diff) |
Merge series "ASoC: soc-core: tidyup error handling for rtd" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark
These are small clanup patches for soc-core.
[1/2] patch adds missing explanation, and
[2/2] patch fixup error handling of rtd.
Kuninori Morimoto (2):
ASoC: soc-core: add comment for rtd freeing
ASoC: soc-core: use device_unregister() if rtd allocation failed
sound/soc/soc-core.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--
2.25.1
-rw-r--r-- | sound/soc/soc-core.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 522bae73640a..236e075b9e57 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -413,6 +413,14 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd) * it is alloced *before* rtd. * see * soc_new_pcm_runtime() + * + * We don't need to mind freeing for rtd, + * because it was created from dev (= rtd->dev) + * see + * soc_new_pcm_runtime() + * + * rtd = devm_kzalloc(dev, ...); + * rtd->dev = dev */ device_unregister(rtd->dev); } @@ -462,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); |