Skip to content

Commit

Permalink
ARM: SAMSUNG: fix race in s3c_adc_start for ADC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Todd Poynor authored and Kukjin Kim committed Jul 13, 2012
1 parent bdd3cc2 commit 8265981
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/arm/plat-samsung/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8265981

Please sign in to comment.