From: Takashi Iwai Date: Mon, 4 Sep 2017 13:54:47 +0000 (+0200) Subject: ASoC: cs43130: Fix possible Oops with invalid dev_id X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f31877a16b0926dea4d1d9b72917a3eca9be19b6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: 8f1e5bf9b440 ("ASoC: cs43130: Add support for CS43130 codec") Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 9f1aa0516fd0..4229a95e2859 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;