summaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2022-09-08 02:45:12 +0000
committerMark Brown <broonie@kernel.org>2022-09-08 11:39:39 +0100
commit6ef8443fb1ced148417d830894240a097ba79a03 (patch)
tree1c7f6419d9f99dd54759fe0e8e37e43c53fe054e /sound/soc/soc-dapm.c
parente0d38f88e977e7fb6a8aa4d4f31720b1c9b7817e (diff)
ASoC: soc-dapm.c: add comment for kzalloc()/kfree() on snd_soc_dai_link_event_pre_pmu()
snd_soc_dai_link_event_pre_pmu() is using kzalloc()/kfree() for params. It looks we don't need to use these, but are necessary. But, it is difficult to know why it is necessary without any comments. This patch adds the reasons via comment. Link: https://lore.kernel.org/all/Yxc2wzbZsSVZNf8Y@sirena.org.uk/ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/878rmubn47.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 76615d59e2b6..fc2f75ed190d 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3842,6 +3842,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
unsigned int fmt;
int ret = 0;
+ /*
+ * NOTE
+ *
+ * snd_pcm_hw_params is quite large (608 bytes on arm64) and is
+ * starting to get a bit excessive for allocation on the stack,
+ * especially when you're building with some of the KASAN type
+ * stuff that increases stack usage.
+ * So, we use kzalloc()/kfree() for params in this function.
+ */
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (!params)
return -ENOMEM;
@@ -3939,7 +3948,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
runtime->rate = params_rate(params);
out:
+ /* see above NOTE */
kfree(params);
+
return ret;
}