pipeline: fix data structure linking

cppcheck was being confused as we were passing in hw_param_ctx which has
linking in the following order hw_param_ctx->data->hw_params.

Cppcheck was being confused as it failed to realize that hw_params was a
writeback method and to be honest the way it was written they way the
structures were linked was hard to see as well. Lets do all the linking
upfront so its easier to read. Cppcheck doesn't seem to complain about
this method so lets use it.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit is contained in:
Curtis Malainey 2021-01-15 14:56:35 -08:00 committed by Liam Girdwood
parent 300f717943
commit fd2d94dd79
1 changed files with 4 additions and 5 deletions

View File

@ -517,7 +517,10 @@ int pipeline_params(struct pipeline *p, struct comp_dev *host,
struct sof_ipc_pcm_params *params)
{
struct sof_ipc_pcm_params hw_params;
struct pipeline_data data;
struct pipeline_data data = {
.start = host,
.params = &hw_params,
};
struct pipeline_walk_context hw_param_ctx = {
.comp_func = pipeline_comp_hw_params,
.comp_data = &data,
@ -541,10 +544,6 @@ int pipeline_params(struct pipeline *p, struct comp_dev *host,
params->params.sample_valid_bytes,
params->params.sample_container_bytes);
/* settin hw params */
data.start = host;
data.params = &hw_params;
ret = hw_param_ctx.comp_func(host, NULL, &hw_param_ctx, dir);
if (ret < 0) {
pipe_err(p, "pipeline_params(): ret = %d, dev->comp.id = %u",