Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64a109dc authored by Meng Wang's avatar Meng Wang
Browse files

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: default avatarMeng Wang <mwang@codeaurora.org>
parent 7c8a2f0c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
		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++)
		snd_soc_update_bits(codec, imped_table[index][i].reg,
				imped_table[index][i].mask,