diff options
author | Mark Brown <broonie@kernel.org> | 2022-09-08 13:31:27 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-09-08 13:31:27 +0100 |
commit | 523820002ea725b37f67e82e8584543b5f7baa32 (patch) | |
tree | a3277798f65935ac143dcc37a41f8514b92724e6 /sound/soc | |
parent | e9e7df88996d64544178f48b0299dfe736c6aa22 (diff) | |
parent | 59a1063dcaa5c9450dc1d221679418747bf086fc (diff) |
ASoC: soc-dapm.c: random cleanup retry
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
These are remains of my previous cleanup patch-set.
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-dapm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 76615d59e2b6..47a7bf99472e 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; @@ -3891,16 +3900,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, } /* Be a little careful as we don't want to overflow the mask array */ - if (config->formats) { - fmt = ffs(config->formats) - 1; - } else { - dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", - config->formats); + if (!config->formats) { + dev_warn(w->dapm->dev, "ASoC: Invalid format was specified\n"); ret = -EINVAL; goto out; } + fmt = ffs(config->formats) - 1; + snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt); hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = config->rate_min; @@ -3939,7 +3947,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; } |