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
This commit is contained in:
Mark Brown 2021-04-01 10:25:12 +01:00
commit 73935e931c
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -413,6 +413,14 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd)
* it is alloced *before* rtd. * it is alloced *before* rtd.
* see * see
* soc_new_pcm_runtime() * 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); 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_codecs +
dai_link->num_platforms), dai_link->num_platforms),
GFP_KERNEL); GFP_KERNEL);
if (!rtd) if (!rtd) {
goto free_rtd; device_unregister(dev);
return NULL;
}
rtd->dev = dev; rtd->dev = dev;
INIT_LIST_HEAD(&rtd->list); INIT_LIST_HEAD(&rtd->list);