Skip to content

Commit c6631ce

Browse files
Jack Yubroonie
authored andcommitted
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>
1 parent 45b3605 commit c6631ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/soc/codecs/rt-sdw-common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ int rt_sdca_headset_detect(struct regmap *map, unsigned int entity_id)
150150
goto io_error;
151151

152152
switch (det_mode) {
153-
case 0x00:
154-
jack_type = 0;
155-
break;
156153
case 0x03:
157154
jack_type = SND_JACK_HEADPHONE;
158155
break;
159156
case 0x05:
160157
jack_type = SND_JACK_HEADSET;
161158
break;
159+
default:
160+
jack_type = 0;
161+
break;
162162
}
163163

164164
/* write selected_mode */

0 commit comments

Comments
 (0)