Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@vger.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://patch.msgid.link/20250116142436.22389-1-n.zhandarovich@fintech.ru
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Nikita Zhandarovich and committed by
Mark Brown
a8c9a453 2014c95a

+2
+2
sound/soc/fsl/fsl_micfil.c
··· 183 183 case QUALITY_VLOW2: 184 184 qsel = MICFIL_QSEL_VLOW2_QUALITY; 185 185 break; 186 + default: 187 + return -EINVAL; 186 188 } 187 189 188 190 return regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL2,