Commit 52382000 authored by Mark Brown's avatar Mark Brown

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.
parents e9e7df88 59a1063d
...@@ -3842,6 +3842,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, ...@@ -3842,6 +3842,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
unsigned int fmt; unsigned int fmt;
int ret = 0; 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); params = kzalloc(sizeof(*params), GFP_KERNEL);
if (!params) if (!params)
return -ENOMEM; return -ENOMEM;
...@@ -3891,16 +3900,15 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, ...@@ -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 */ /* Be a little careful as we don't want to overflow the mask array */
if (config->formats) { if (!config->formats) {
fmt = ffs(config->formats) - 1; dev_warn(w->dapm->dev, "ASoC: Invalid format was specified\n");
} else {
dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n",
config->formats);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
fmt = ffs(config->formats) - 1;
snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt); snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt);
hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min =
config->rate_min; config->rate_min;
...@@ -3939,7 +3947,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, ...@@ -3939,7 +3947,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
runtime->rate = params_rate(params); runtime->rate = params_rate(params);
out: out:
/* see above NOTE */
kfree(params); kfree(params);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment