diff mbox series

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

Message ID 8631337239d744088d56caab2d8f39cb@realtek.com (mailing list archive)
State Accepted
Commit c6631ceea573ae364e4fe913045f2aad10a10784
Headers show
Series [v2] ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized variable | expand

Commit Message

Jack Yu Oct. 14, 2024, 9:55 a.m. UTC
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>
---
 sound/soc/codecs/rt-sdw-common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Brown Oct. 14, 2024, 4:22 p.m. UTC | #1
On Mon, 14 Oct 2024 09:55:20 +0000, Jack Yu wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized variable
      commit: c6631ceea573ae364e4fe913045f2aad10a10784

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt-sdw-common.c b/sound/soc/codecs/rt-sdw-common.c
index a422da6cf702..9f51fec383f9 100644
--- a/sound/soc/codecs/rt-sdw-common.c
+++ b/sound/soc/codecs/rt-sdw-common.c
@@ -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 */