ASoC: mediatek: mt9195-mt6359: fix UNINIT problem
authorTrevor Wu <trevor.wu@mediatek.com>
Tue, 7 Mar 2023 04:09:36 +0000 (12:09 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 13 Mar 2023 14:08:37 +0000 (14:08 +0000)
Coverity shows using uninitialized value monitor. When regmap_read
returns an error, monitor keeps the value left from earlier
computation. To prevent from the unexpected result in the case, assign
0 to monitor.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230307040938.7484-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8195/mt8195-mt6359.c

index 4682748d82bed46e649ad6406817f920f1e81547..ceca882ecff7b20a2d9cafb41d28c4ba3f58e647 100644 (file)
@@ -158,7 +158,7 @@ static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
        int mtkaif_phase_cycle[MT8195_MTKAIF_MISO_NUM];
        int mtkaif_calibration_num_phase;
        bool mtkaif_calibration_ok;
-       unsigned int monitor;
+       unsigned int monitor = 0;
        int counter;
        int phase;
        int i;