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: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:
@@ -220,11 +220,18 @@ static int dmic_swr_ctrl(struct snd_soc_dapm_widget *w,
|
|||||||
u8 port_type = 0;
|
u8 port_type = 0;
|
||||||
u8 port_id = w->shift;
|
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 1 is high quality / 2.4 or 3.072 Mbps
|
||||||
* Port 2 is listen low power / 0.6 or 0.768 Mbps
|
* Port 2 is listen low power / 0.6 or 0.768 Mbps
|
||||||
*/
|
*/
|
||||||
if(port_id == SWR_DMIC_HIFI_PORT)
|
if (port_id == SWR_DMIC_HIFI_PORT)
|
||||||
ch_rate = SWR_CLK_RATE_2P4MHZ;
|
ch_rate = SWR_CLK_RATE_2P4MHZ;
|
||||||
else
|
else
|
||||||
ch_rate = SWR_CLK_RATE_0P6MHZ;
|
ch_rate = SWR_CLK_RATE_0P6MHZ;
|
||||||
|
Reference in New Issue
Block a user