Skip to content

Commit

Permalink
ASoC: cs43130: Fix possible Oops with invalid dev_id
Browse files Browse the repository at this point in the history
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 <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Takashi Iwai authored and Mark Brown committed Sep 4, 2017
1 parent 83ef26a commit f31877a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sound/soc/codecs/cs43130.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f31877a

Please sign in to comment.