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:28 +0900
committerMark Brown <broonie@kernel.org>2021-03-31 18:02:22 +0100
commitf1b3ee789f4b7a41ad93ff42d4efbae607622ae7 (patch)
tree624bd88000e3a4e6e5f5fdcce159ab0238e2b388 /sound/soc/soc-core.c
parentMerge tag 'mute-led-rework' of https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-5.13 (diff)
downloadwireguard-linux-f1b3ee789f4b7a41ad93ff42d4efbae607622ae7.tar.xz
wireguard-linux-f1b3ee789f4b7a41ad93ff42d4efbae607622ae7.zip
ASoC: soc-core: add comment for rtd freeing
We don't need to mind freeing for rtd, because it was created from devm_kzalloc(dev, xxx) which is rtd->dev. This means, if rtd->dev was freed, rtd will be also freed automatically. soc_new_pcm_runtime(...) { ... rtd = devm_kzalloc(dev, ...); rtd->dev = dev; ... } This explanation was missing at soc_free_pcm_runtime() comment. This patch indicates it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sg4dxldn.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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 522bae73640a..88694746dc11 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);
}