summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2012-07-13 15:30:48 +0900
committerKukjin Kim <kgene.kim@samsung.com>2012-07-13 15:35:04 +0900
commit8265981bb439f3ecc5356fb877a6c2a6636ac88a (patch)
treec95e3b84c46bcc9d39c1d3d0e98c82ccb8088a7c
parentbdd3cc26ba651e33780ade33f1410320cf2d0cf4 (diff)
ARM: SAMSUNG: fix race in s3c_adc_start for ADC
Checking for adc->ts_pend already claimed should be done with the lock held. Signed-off-by: Todd Poynor <toddpoynor@google.com> Acked-by: Ben Dooks <ben-linux@fluff.org> Cc: Stable <stable@vger.kernel.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/plat-samsung/adc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 33ecd0c9f0c..b1e05ccff3a 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -157,11 +157,13 @@ int s3c_adc_start(struct s3c_adc_client *client,
return -EINVAL;
}
- if (client->is_ts && adc->ts_pend)
- return -EAGAIN;
-
spin_lock_irqsave(&adc->lock, flags);
+ if (client->is_ts && adc->ts_pend) {
+ spin_unlock_irqrestore(&adc->lock, flags);
+ return -EAGAIN;
+ }
+
client->channel = channel;
client->nr_samples = nr_samples;