--- Begin Message ---
- To: <broonie@xxxxxxxxxx>, <lgirdwood@xxxxxxxxx>, <tiwai@xxxxxxxx>, <perex@xxxxxxxx>, <matthias.bgg@xxxxxxxxx>, <angelogioacchino.delregno@xxxxxxxxxxxxx>
- Subject: [PATCH 3/4] ASoC: mediatek: mt6358: fix UNINIT problem
- From: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
- Date: Tue, 7 Mar 2023 12:09:37 +0800
- Cc: trevor.wu@xxxxxxxxxxxx, jiaxin.yu@xxxxxxxxxxxx, alsa-devel@xxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- In-reply-to: <20230307040938.7484-1-trevor.wu@mediatek.com>
- References: <20230307040938.7484-1-trevor.wu@mediatek.com>
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 <trevor.wu@xxxxxxxxxxxx>
---
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);
--
2.18.0
--- End Message ---