From: Takashi Iwai Subject: Re: [PATCH] ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly Date: Tue, 07 May 2019 22:47:00 +0200 Message-ID: References: <20190507193910.23943-1-tiwai@suse.de> <1f114472-a9c0-503a-57a2-c3a0a9bbcf30@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5186FF807B5 for ; Tue, 7 May 2019 22:47:01 +0200 (CEST) In-Reply-To: <1f114472-a9c0-503a-57a2-c3a0a9bbcf30@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Pierre-Louis Bossart Cc: Liam Girdwood , Jaska Uimonen , alsa-devel@alsa-project.org, Mark Brown List-Id: alsa-devel@alsa-project.org On Tue, 07 May 2019 21:54:11 +0200, Pierre-Louis Bossart wrote: > > > > On 5/7/19 2:39 PM, Takashi Iwai wrote: > > 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. > > Thanks Takashi. > > I don't recall having seen this warning and this code has been around > for a while. Does this show with a special config/compiler? I got this by a few cross-compilations (e.g. arm64), so it might be specific to some configs, yes. Takashi > > Adding Jaska since he wrote the support for large control data. > > > > > Fixes: 53e0c72d98ba ("ASoC: SOF: Add support for IPC IO between DSP and Host") > > Signed-off-by: Takashi Iwai > > --- > > sound/soc/sof/ipc.c | 10 +++++++--- > > 1 file 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; > > >