From patchwork Tue May 7 19:39:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10933715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61C9914B6 for ; Tue, 7 May 2019 19:40:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5133D2875F for ; Tue, 7 May 2019 19:40:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42E33287B6; Tue, 7 May 2019 19:40:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F30C287DE for ; Tue, 7 May 2019 19:40:11 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8197B17A6; Tue, 7 May 2019 21:39:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8197B17A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1557258009; bh=owK5zqJ/cw9lXOvm5KZzmC5yWbPxCPQ00R7M7HdB17k=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=u7pN0/alpcFrDkfCHy9XVvJPdy0hv9rHB+WklPpIuPcj8lpOk4/USncnYyecnV6VI q8ODHl7pTnyOd3UQ5XJxwN+S2AXPHMjVFN0EaruTLxFmAZ80mdjyDXTL+8vE70L4uA gnoksoJBjTPKLtd3vAFmEQJH0fODQNK/cREx+nyA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 066A7F89673; Tue, 7 May 2019 21:39:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1D40AF89674; Tue, 7 May 2019 21:39:16 +0200 (CEST) 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 566ADF89671 for ; Tue, 7 May 2019 21:39:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 566ADF89671 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2292FAC1B; Tue, 7 May 2019 19:39:12 +0000 (UTC) From: Takashi Iwai To: Mark Brown Date: Tue, 7 May 2019 21:39:10 +0200 Message-Id: <20190507193910.23943-1-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 Cc: Liam Girdwood , alsa-devel@alsa-project.org, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH] ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;