From patchwork Tue Mar 7 04:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?VHJldm9yIFd1ICjlkLPmlofoia8p?= X-Patchwork-Id: 13162751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12887C678D5 for ; Tue, 7 Mar 2023 04:12:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3D8A81327; Tue, 7 Mar 2023 05:11:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3D8A81327 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678162333; bh=9w+UDHfn5T8YznXMvwEeLxr2txle+48TJu+6zQg3Ztg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Reply-To:Cc:From; b=X+hlrDVjmnt04Ozxq/3utyIE/vPT/s61izeaC/QmNuqOfUoD2Gxw9q7mvndKJcsVN 5XRQZrnt8Gll24Yicuc/JMk8ELKyUIzoOj9wytEzYw8FUhm7yypyBCsrRb6lqRq8AO gEJIfoZMUhRXkV2q3TjBTNgd/1yrgQ2hO6YYKa5I= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 75A99F80548; Tue, 7 Mar 2023 05:10:19 +0100 (CET) To: , , , , , Subject: [PATCH 3/4] ASoC: mediatek: mt6358: fix UNINIT problem Date: Tue, 7 Mar 2023 12:09:37 +0800 In-Reply-To: <20230307040938.7484-1-trevor.wu@mediatek.com> References: <20230307040938.7484-1-trevor.wu@mediatek.com> X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <167816221839.26.4600710524407532007@mailman-core.alsa-project.org> X-Patchwork-Original-From: Trevor Wu via Alsa-devel From: =?utf-8?b?VHJldm9yIFd1ICjlkLPmlofoia8p?= Reply-To: Trevor Wu Cc: trevor.wu@mediatek.com, jiaxin.yu@mediatek.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Disposition: inline Coverity shows decaring variable reg without initializer. When regmap_read returns an error, reg keeps the value left from earlier computation. To prevent from the unexpected result in the case, assign 0 to reg. Signed-off-by: Trevor Wu --- sound/soc/codecs/mt6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c index b54610b27906..d7b157ddc9a8 100644 --- a/sound/soc/codecs/mt6358.c +++ b/sound/soc/codecs/mt6358.c @@ -429,7 +429,7 @@ static int mt6358_put_volsw(struct snd_kcontrol *kcontrol, struct mt6358_priv *priv = snd_soc_component_get_drvdata(component); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; - unsigned int reg; + unsigned int reg = 0; int ret; ret = snd_soc_put_volsw(kcontrol, ucontrol);