Skip to content

Commit

Permalink
ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly
Browse files Browse the repository at this point in the history
This fixes a compile warning below by properly handling the error code
from sof_get_ctrl_copy_params():
  include/linux/kernel.h:843:43: warning: 'sparams.pl_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
  sound/soc/sof/ipc.c:639:34: note: 'sparams.pl_size' was declared here

The function returns an error before setting sparams.pl_size, so it'd
assign an uninitialized value at a later point.

Fixes: 53e0c72 ("ASoC: SOF: Add support for IPC IO between DSP and Host")
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
tiwai authored and broonie committed May 8, 2019
1 parent f153bf4 commit 54d198d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev,
size_t offset = 0;
size_t msg_bytes;
size_t pl_size;
int err = 0;
int err;
int i;

/* allocate max ipc size because we have at least one */
Expand All @@ -576,9 +576,13 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev,
return -ENOMEM;

if (send)
sof_get_ctrl_copy_params(cdata->type, cdata, partdata, sparams);
err = sof_get_ctrl_copy_params(cdata->type, cdata, partdata,
sparams);
else
sof_get_ctrl_copy_params(cdata->type, partdata, cdata, sparams);
err = sof_get_ctrl_copy_params(cdata->type, partdata, cdata,
sparams);
if (err < 0)
return err;

msg_bytes = sparams->msg_bytes;
pl_size = sparams->pl_size;
Expand Down

0 comments on commit 54d198d

Please sign in to comment.