All of lore.kernel.org
 help / color / mirror / Atom feed
From: Todd Poynor <toddpoynor@google.com>
To: Ben Dooks <ben-linux@fluff.org>, Kukjin Kim <kgene.kim@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, eunki_kim@samsung.com,
	Todd Poynor <toddpoynor@google.com>
Subject: [PATCH] ARM: samsung: adc: fix race in s3c_adc_start
Date: Wed, 11 Jul 2012 19:12:11 -0700	[thread overview]
Message-ID: <1342059131-31251-1-git-send-email-toddpoynor@google.com> (raw)

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(-)

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;
 
-- 
1.7.7.3

WARNING: multiple messages have this Message-ID (diff)
From: toddpoynor@google.com (Todd Poynor)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: samsung: adc: fix race in s3c_adc_start
Date: Wed, 11 Jul 2012 19:12:11 -0700	[thread overview]
Message-ID: <1342059131-31251-1-git-send-email-toddpoynor@google.com> (raw)

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(-)

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;
 
-- 
1.7.7.3

             reply	other threads:[~2012-07-12  2:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12  2:12 Todd Poynor [this message]
2012-07-12  2:12 ` [PATCH] ARM: samsung: adc: fix race in s3c_adc_start Todd Poynor
2012-07-12 12:31 ` Ben Dooks
2012-07-12 12:31   ` Ben Dooks
2012-07-12 22:41   ` Kukjin Kim
2012-07-12 22:41     ` Kukjin Kim
2012-07-13  1:35     ` Todd Poynor
2012-07-13  1:35       ` Todd Poynor
2012-07-13 11:28       ` Kukjin Kim
2012-07-13 11:28         ` Kukjin Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342059131-31251-1-git-send-email-toddpoynor@google.com \
    --to=toddpoynor@google.com \
    --cc=ben-linux@fluff.org \
    --cc=eunki_kim@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.