Skip to content

Commit

Permalink
ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized var…
Browse files Browse the repository at this point in the history
…iable

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>
  • Loading branch information
Jack Yu authored and Mark Brown committed Oct 14, 2024
1 parent 45b3605 commit c6631ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/soc/codecs/rt-sdw-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ int rt_sdca_headset_detect(struct regmap *map, unsigned int entity_id)
goto io_error;

switch (det_mode) {
case 0x00:
jack_type = 0;
break;
case 0x03:
jack_type = SND_JACK_HEADPHONE;
break;
case 0x05:
jack_type = SND_JACK_HEADSET;
break;
default:
jack_type = 0;
break;
}

/* write selected_mode */
Expand Down

0 comments on commit c6631ce

Please sign in to comment.