alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ASoC: cs43130: Fix possible Oops with invalid dev_id
@ 2017-09-04 13:54 Takashi Iwai
  2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2017-09-04 13:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

As compiler spotted out, there is the potential NULL-dereference in
the code when dc-measure OF is given for other than 43130/43131:
  sound/soc/codecs/cs43130.c:2089:18: warning: ‘hpload_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Warn it and return before triggering Oops.

Fixes: 8f1e5bf9b440 ("ASoC: cs43130: Add support for CS43130 codec")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/codecs/cs43130.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
index 220e30199c5b..3fe3b8d644b7 100644
--- a/sound/soc/codecs/cs43130.c
+++ b/sound/soc/codecs/cs43130.c
@@ -2079,6 +2079,10 @@ static void cs43130_imp_meas(struct work_struct *wk)
 	case CS43131_CHIP_ID:
 		hpload_seq = hpload_seq2;
 		seq_size = ARRAY_SIZE(hpload_seq2);
+		break;
+	default:
+		WARN(1, "Invalid dev_id for meas: %d", cs43130->dev_id);
+		return;
 	}
 
 	i = 0;
-- 
2.14.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-09-04 15:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 13:54 [PATCH v2 1/2] ASoC: cs43130: Fix possible Oops with invalid dev_id Takashi Iwai
2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
2017-09-04 14:31   ` Daniel Baluta
2017-09-04 14:34     ` Takashi Iwai
2017-09-04 14:44       ` Mark Brown
2017-09-04 15:46         ` Daniel Baluta
2017-09-04 14:49   ` Applied "ASoC: cs43130: Fix unused compiler warnings for PM runtime" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).