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

ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized variable

If det_mode is not 0, 3 or 5 then function will return
jack_type with an uninitialzed value.
Enhance switch case to prevent uninitialized variable issue.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://patch.msgid.link/8631337239d744088d56caab2d8f39cb@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jack Yu and committed by
Mark Brown
c6631cee 45b36050

+3 -3
+3 -3
sound/soc/codecs/rt-sdw-common.c
··· 150 150 goto io_error; 151 151 152 152 switch (det_mode) { 153 - case 0x00: 154 - jack_type = 0; 155 - break; 156 153 case 0x03: 157 154 jack_type = SND_JACK_HEADPHONE; 158 155 break; 159 156 case 0x05: 160 157 jack_type = SND_JACK_HEADSET; 158 + break; 159 + default: 160 + jack_type = 0; 161 161 break; 162 162 } 163 163