Skip to content

Commit f31877a

Browse files
tiwaibroonie
authored andcommitted
ASoC: cs43130: Fix possible Oops with invalid dev_id
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: 8f1e5bf ("ASoC: cs43130: Add support for CS43130 codec") Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 83ef26a commit f31877a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/soc/codecs/cs43130.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,10 @@ static void cs43130_imp_meas(struct work_struct *wk)
20792079
case CS43131_CHIP_ID:
20802080
hpload_seq = hpload_seq2;
20812081
seq_size = ARRAY_SIZE(hpload_seq2);
2082+
break;
2083+
default:
2084+
WARN(1, "Invalid dev_id for meas: %d", cs43130->dev_id);
2085+
return;
20822086
}
20832087

20842088
i = 0;

0 commit comments

Comments
 (0)