[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250116142436.22389-1-n.zhandarovich@fintech.ru>
Date: Thu, 16 Jan 2025 06:24:36 -0800
From: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
To: Shengjiu Wang <shengjiu.wang@...il.com>, Xiubo Li <Xiubo.Lee@...il.com>
CC: Nikita Zhandarovich <n.zhandarovich@...tech.ru>, Fabio Estevam
<festevam@...il.com>, Nicolin Chen <nicoleotsuka@...il.com>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Jaroslav Kysela
<perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
<linux-sound@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] ASoC: fsl_micfil: Enable default case in micfil_set_quality()
If 'micfil->quality' received from micfil_quality_set() somehow ends
up with an unpredictable value, switch() operator will fail to
initialize local variable qsel before regmap_update_bits() tries
to utilize it.
While it is unlikely, play it safe and enable a default case that
returns -EINVAL error.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: bea1d61d5892 ("ASoC: fsl_micfil: rework quality setting")
Cc: stable@...r.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
---
sound/soc/fsl/fsl_micfil.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index 8c15389c9a04..5585f4c8f455 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -157,6 +157,8 @@ static int micfil_set_quality(struct fsl_micfil *micfil)
case QUALITY_VLOW2:
qsel = MICFIL_QSEL_VLOW2_QUALITY;
break;
+ default:
+ return -EINVAL;
}
return regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL2,
Powered by blists - more mailing lists