diff mbox series

ASoC: codecs: aw88261: avoid uninitialized variable warning

Message ID 20230808125703.1611325-1-arnd@kernel.org
State New
Headers show
Series ASoC: codecs: aw88261: avoid uninitialized variable warning | expand

Commit Message

Arnd Bergmann Aug. 8, 2023, 12:56 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

aw88261_reg_update() returns an unintialized error code in the
success path:

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) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Return zero instead here.

Fixes: 028a2ae256916 ("ASoC: codecs: Add aw88261 amplifier driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/codecs/aw88261.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index 82923b454dd47..6e2266b713862 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -652,6 +652,8 @@  static int aw88261_reg_update(struct aw88261 *aw88261, bool force)
 			ret = aw88261_dev_fw_update(aw88261);
 			if (ret)
 				return ret;
+		} else {
+			ret = 0;
 		}
 	}