diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-05-07 21:39:10 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-05-08 15:20:25 +0900 |
commit | 54d198d5019dd98b9bcb9099a389608d7e2cccad (patch) | |
tree | 8169236a4c79ef2c7b65690be79bbcdf34d34ca0 /sound | |
parent | f153bf49ddf6169544b24ef5ea26fa3eb4996b95 (diff) | |
download | lwn-54d198d5019dd98b9bcb9099a389608d7e2cccad.tar.gz lwn-54d198d5019dd98b9bcb9099a389608d7e2cccad.zip |
ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly
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: 53e0c72d98ba ("ASoC: SOF: Add support for IPC IO between DSP and Host")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/sof/ipc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index ba1bb17a8d1e..f0b9d3c53f6f 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -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 */ @@ -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; |