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

Commit d6ccb466 authored by Vignesh Kulothungan's avatar Vignesh Kulothungan
Browse files

ASoC: swr-dmic: fix kw error in dmic_swr_ctrl



Add array bounds check for index before accessing
tx_master_port_map.

Change-Id: I52a8dbdaf40974a45e86b3dca4caa27d88a7b864
Signed-off-by: default avatarVignesh Kulothungan <vigneshk@codeaurora.org>
parent 3944bb8d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -220,6 +220,13 @@ static int dmic_swr_ctrl(struct snd_soc_dapm_widget *w,
	u8 port_type = 0;
	u8 port_id = w->shift;

	if (port_id >= SWR_DMIC_MAX_PORTS)
	{
		dev_err(component->dev, "%s: invalid port id: %d\n",
			__func__, port_id);
		return -EINVAL;
	}

	/*
	 * Port 1 is high quality / 2.4 or 3.072 Mbps
	 * Port 2 is listen low power / 0.6 or 0.768 Mbps