ASoC: wcd9xxx: check impedance index before use
Impedance index may be out of range. Check if impedance index is out of range before use. CRs-Fixed: 1046606 Change-Id: Ia490d15a51ad70759c917fbe7e84fdadaa140e20 Signed-off-by: Meng Wang <mwang@codeaurora.org>
This commit is contained in:
parent
11d6060fff
commit
c1a7f6ff7b
1 changed files with 5 additions and 0 deletions
|
@ -198,6 +198,11 @@ void wcd_clsh_imped_config(struct snd_soc_codec *codec, int imped, bool reset)
|
||||||
pr_debug("%s, impedance not in range = %d\n", __func__, imped);
|
pr_debug("%s, impedance not in range = %d\n", __func__, imped);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (index >= ARRAY_SIZE(imped_table)) {
|
||||||
|
pr_debug("%s, impedance index not in range = %d\n", __func__,
|
||||||
|
index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (i = 0; i < MAX_IMPED_PARAMS; i++)
|
for (i = 0; i < MAX_IMPED_PARAMS; i++)
|
||||||
snd_soc_update_bits(codec, imped_table[index][i].reg,
|
snd_soc_update_bits(codec, imped_table[index][i].reg,
|
||||||
imped_table[index][i].mask,
|
imped_table[index][i].mask,
|
||||||
|
|
Loading…
Add table
Reference in a new issue