[alsa-devel] [PATCH 09/13] ASoC: soc-core: use devm_kzalloc() for rtd
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Sep 11 01:54:54 CEST 2019
Hi Sridharan
Thank you for your review
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -370,11 +370,8 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd)
> if (!rtd)
> return;
>
> - kfree(rtd->codec_dais);
> - if (rtd->dev)
> - device_unregister(rtd->dev); /* soc_release_rtd_dev */
> list_del(&rtd->list);
> - kfree(rtd);
>
> Morimoto-san,
>
> Just curious, why did you remove the check for if(rtd->dev) here before calling device_unregister()?
>
> Thanks,
> Ranjani
>
> + device_unregister(rtd->dev); /* soc_release_rtd_dev */
> }
Can you check [07/13] patch ?
It allocs rtd->dev (as dev) first, and allocs rtd next.
This means, if it has rtd, it has rtd->dev.
Here, this function checks rtd pointer.
If rtd is not NULL, rtd->dev is also not NULL.
But, indeed it is a littile bit tricky ?
Some comment is needed.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list