mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
Merge "asoc: codecs: wcd938x: Add boundary checks before accessing array"
This commit is contained in:
commit
a1f6d79060
1 changed files with 21 additions and 6 deletions
|
|
@ -1655,13 +1655,20 @@ static int wcd938x_tx_mode_get(struct snd_kcontrol *kcontrol,
|
|||
snd_soc_dapm_kcontrol_widget(kcontrol);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_kcontrol_component(kcontrol);
|
||||
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
|
||||
u32 path = 0;
|
||||
struct wcd938x_priv *wcd938x = NULL;
|
||||
int path = 0;
|
||||
|
||||
if (!widget || !widget->name || !wcd938x || !component)
|
||||
if (!component)
|
||||
return -EINVAL;
|
||||
|
||||
wcd938x = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!widget || !widget->name || !wcd938x)
|
||||
return -EINVAL;
|
||||
|
||||
path = wcd938x_tx_path_get(widget->name);
|
||||
if (path < 0 || path >= TX_ADC_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
ucontrol->value.integer.value[0] = wcd938x->tx_mode[path];
|
||||
|
||||
|
|
@ -1675,14 +1682,22 @@ static int wcd938x_tx_mode_put(struct snd_kcontrol *kcontrol,
|
|||
snd_soc_dapm_kcontrol_widget(kcontrol);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_kcontrol_component(kcontrol);
|
||||
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
|
||||
struct wcd938x_priv *wcd938x = NULL;
|
||||
u32 mode_val;
|
||||
u32 path = 0;
|
||||
int path = 0;
|
||||
|
||||
if (!widget || !widget->name || !wcd938x || !component)
|
||||
if (!component)
|
||||
return -EINVAL;
|
||||
|
||||
wcd938x = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!widget || !widget->name || !wcd938x)
|
||||
return -EINVAL;
|
||||
|
||||
path = wcd938x_tx_path_get(widget->name);
|
||||
if (path < 0 || path >= TX_ADC_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
mode_val = ucontrol->value.enumerated.item[0];
|
||||
|
||||
dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
|
||||
|
|
|
|||
Loading…
Reference in a new issue