[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230810104749.164827-1-krzysztof.kozlowski@linaro.org>
Date: Thu, 10 Aug 2023 12:47:43 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Heiko Stuebner <heiko@...ech.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, llvm@...ts.linux.dev
Cc: Andi Shyti <andi.shyti@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH 1/4] ASoC: aw88261: Fix unitialized ret of aw88261_reg_update()
There is a branch in if() clause where aw88261_reg_update() could return
uninitialized value. Pounted out by W=1 clang build:
sound/soc/codecs/aw88261.c:651:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (aw_dev->prof_cur != aw_dev->prof_index) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/aw88261.c:660:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/aw88261.c:651:3: note: remove the 'if' if its condition is always true
if (aw_dev->prof_cur != aw_dev->prof_index) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
---
sound/soc/codecs/aw88261.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index 82923b454dd4..fddba2f2de41 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -636,7 +636,7 @@ static int aw88261_dev_stop(struct aw_device *aw_dev)
static int aw88261_reg_update(struct aw88261 *aw88261, bool force)
{
struct aw_device *aw_dev = aw88261->aw_pa;
- int ret;
+ int ret = 0;
if (force) {
ret = regmap_write(aw_dev->regmap,
--
2.34.1
Powered by blists - more mailing lists