diff mbox

ARM: samsung: adc: fix race in s3c_adc_start

Message ID 1342059131-31251-1-git-send-email-toddpoynor@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Todd Poynor July 12, 2012, 2:12 a.m. UTC
Checking for adc->ts_pend already claimed should be done with the
lock held.

Change-Id: Ic9f15e26bd19934ab8c2885ce5df265933ac304a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
 arch/arm/plat-samsung/adc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Comments

Ben Dooks July 12, 2012, 12:31 p.m. UTC | #1
On Wed, Jul 11, 2012 at 07:12:11PM -0700, Todd Poynor wrote:
> Checking for adc->ts_pend already claimed should be done with the
> lock held.
> 
> Change-Id: Ic9f15e26bd19934ab8c2885ce5df265933ac304a
> Signed-off-by: Todd Poynor <toddpoynor@google.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Kim Kukjin July 12, 2012, 10:41 p.m. UTC | #2
On 07/12/12 21:31, Ben Dooks wrote:
> On Wed, Jul 11, 2012 at 07:12:11PM -0700, Todd Poynor wrote:
>> Checking for adc->ts_pend already claimed should be done with the
>> lock held.
>>
>> Change-Id: Ic9f15e26bd19934ab8c2885ce5df265933ac304a
>> Signed-off-by: Todd Poynor<toddpoynor@google.com>
> Acked-by: Ben Dooks<ben-linux@fluff.org>

Ben, thanks for your ack, will apply.

BTW, Todd, do you want to keep the 'Change-Id' in mainline?
If you don't mind, I'd like to remove it...

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Todd Poynor July 13, 2012, 1:35 a.m. UTC | #3
On Fri, Jul 13, 2012 at 07:41:11AM +0900, Kukjin Kim wrote:
> BTW, Todd, do you want to keep the 'Change-Id' in mainline?
> If you don't mind, I'd like to remove it...

Oops, I forgot to take it out, please do remove it, thanks.


Todd
Kim Kukjin July 13, 2012, 11:28 a.m. UTC | #4
Todd Poynor wrote:
> 
> On Fri, Jul 13, 2012 at 07:41:11AM +0900, Kukjin Kim wrote:
> > BTW, Todd, do you want to keep the 'Change-Id' in mainline?
> > If you don't mind, I'd like to remove it...
> 
> Oops, I forgot to take it out, please do remove it, thanks.
> 
Sure, will remove when I apply this into -fixes.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
diff mbox

Patch

diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 33ecd0c..b1e05cc 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;