1 From d8d0421cddc6ecdec166612d914b8edbcdb96ed0 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Fri, 31 Jul 2009 20:33:31 +0200
4 Subject: [PATCH] ASoC: jack: Fix race in snd_soc_jack_add_gpios
6 The irq can fire as soon as it has been requested, thus all fields accessed
7 from within the irq handler must be initialized prior to requesting the irq.
9 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
11 The patch is against alsa-kernel/master but I guess something similar should also
14 sound/soc/soc-jack.c | 6 +++---
15 1 files changed, 3 insertions(+), 3 deletions(-)
17 diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
18 index 4aa7d8f..1d455ab 100644
19 --- a/sound/soc/soc-jack.c
20 +++ b/sound/soc/soc-jack.c
21 @@ -221,6 +221,9 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
25 + INIT_WORK(&gpios[i].work, gpio_work);
26 + gpios[i].jack = jack;
28 ret = request_irq(gpio_to_irq(gpios[i].gpio),
30 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
31 @@ -234,9 +237,6 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
32 gpio_export(gpios[i].gpio, false);
35 - INIT_WORK(&gpios[i].work, gpio_work);
36 - gpios[i].jack = jack;
38 /* Update initial jack status */
39 snd_soc_jack_gpio_detect(&gpios[i]);