summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorScott Peterson <speterson@nvidia.com>2013-02-08 17:14:17 -0800
committerMandar Padmawar <mpadmawar@nvidia.com>2013-02-19 08:39:42 -0800
commitba43cb0c817dfbc2d51e8cda98330941e10876de (patch)
tree6d95abdcbaf95336d685ab40f20c49fc3ab1e668 /sound
parent9bd34a41737e49321db885b48ee299976e1cb09f (diff)
asoc: tegra: Protect against invalid gpio writes
Protect against calling gpio_direction_output() with an innvalid gpio handle. Bug 1233665 Change-Id: I00dc7a2a254c7f57ba2894328abd52324bcb304d Signed-off-by: Scott Peterson <speterson@nvidia.com> Reviewed-on: http://git-master/r/198978 Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com> Reviewed-by: Matt Wagner <mwagner@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_rt5640.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c
index a66b4c6a1532..16bfa42dec14 100644
--- a/sound/soc/tegra/tegra_rt5640.c
+++ b/sound/soc/tegra/tegra_rt5640.c
@@ -354,7 +354,8 @@ static int tegra_rt5640_jack_notifier(struct notifier_block *self,
if (jack == &tegra_rt5640_hp_jack) {
if (action) {
/* Enable ext mic; enable signal is active-low */
- gpio_direction_output(pdata->gpio_ext_mic_en, 0);
+ if (gpio_is_valid(pdata->gpio_ext_mic_en))
+ gpio_direction_output(pdata->gpio_ext_mic_en, 0);
if (!strncmp(machine->pdata->codec_name, "rt5639", 6))
status_jack = rt5639_headset_detect(codec, 1);
else if (!strncmp(machine->pdata->codec_name, "rt5640",
@@ -376,7 +377,8 @@ static int tegra_rt5640_jack_notifier(struct notifier_block *self,
}
} else {
/* Disable ext mic; enable signal is active-low */
- gpio_direction_output(pdata->gpio_ext_mic_en, 1);
+ if (gpio_is_valid(pdata->gpio_ext_mic_en))
+ gpio_direction_output(pdata->gpio_ext_mic_en, 1);
if (!strncmp(machine->pdata->codec_name, "rt5639", 6))
rt5639_headset_detect(codec, 0);
else if (!strncmp(machine->pdata->codec_name, "rt5640",