@@ -3837,15 +3837,13 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
struct snd_soc_dapm_path *path;
struct snd_soc_dai *source, *sink;
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_pcm_hw_params *params = NULL;
+ struct snd_pcm_hw_params params;
const struct snd_soc_pcm_stream *config = NULL;
struct snd_pcm_runtime *runtime = NULL;
unsigned int fmt;
int ret = 0;
- params = kzalloc(sizeof(*params), GFP_KERNEL);
- if (!params)
- return -ENOMEM;
+ memset(¶ms, 0, sizeof(params));
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
if (!runtime) {
@@ -3902,45 +3900,39 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
goto out;
}
- 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;
- hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max =
- config->rate_max;
- hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->min
- = config->channels_min;
- hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max
- = config->channels_max;
+ snd_mask_set(hw_param_mask(¶ms, SNDRV_PCM_HW_PARAM_FORMAT), fmt);
+ hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->min = config->rate_min;
+ hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->max = config->rate_max;
+ hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS)->min = config->channels_min;
+ hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS)->max = config->channels_max;
substream->stream = SNDRV_PCM_STREAM_CAPTURE;
snd_soc_dapm_widget_for_each_source_path(w, path) {
source = path->source->priv;
- ret = snd_soc_dai_hw_params(source, substream, params);
+ ret = snd_soc_dai_hw_params(source, substream, ¶ms);
if (ret < 0)
goto out;
- dapm_update_dai_unlocked(substream, params, source);
+ dapm_update_dai_unlocked(substream, ¶ms, source);
}
substream->stream = SNDRV_PCM_STREAM_PLAYBACK;
snd_soc_dapm_widget_for_each_sink_path(w, path) {
sink = path->sink->priv;
- ret = snd_soc_dai_hw_params(sink, substream, params);
+ ret = snd_soc_dai_hw_params(sink, substream, ¶ms);
if (ret < 0)
goto out;
- dapm_update_dai_unlocked(substream, params, sink);
+ dapm_update_dai_unlocked(substream, ¶ms, sink);
}
- runtime->format = params_format(params);
- runtime->subformat = params_subformat(params);
- runtime->channels = params_channels(params);
- runtime->rate = params_rate(params);
-
+ runtime->format = params_format(¶ms);
+ runtime->subformat = params_subformat(¶ms);
+ runtime->channels = params_channels(¶ms);
+ runtime->rate = params_rate(¶ms);
out:
- kfree(params);
return ret;
}