From patchwork Thu Jul 12 02:12:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 1186341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A79F8DF25A for ; Thu, 12 Jul 2012 02:15:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sp8tX-0006sI-Fm; Thu, 12 Jul 2012 02:12:43 +0000 Received: from mail-vb0-f73.google.com ([209.85.212.73]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sp8tQ-0006qv-4z for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 02:12:38 +0000 Received: by vbkv13 with SMTP id v13so192218vbk.0 for ; Wed, 11 Jul 2012 19:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=gw9tTNHR6HjZNbFEnB4uq2GpdB/ZKXuM9/ykZ5FJQjw=; b=G+wQwW0vaDCJXe8KVXKgUKZmvGHsToD+r5oufZo9I76pNfhT5pTCTMt95wf3JxLm6h rPpXsqxwNIJKZ/pjZ+WICuZ7VISCiTlr+O9J9OUN+lPpJ7gijiJw2FvY2eJdrV9P5XxT hsIKanw2A25weahAcZMiJuy1iGbnySXNPDSyVp8M/UJ4aseLp0TgT2Ba//29hXc4yhti JtIaMWFOe8MybvvvPdoZz/seh/577esKdOeMWXPgStnWJv+p6veth4GrDAPxOq5EMDqb Z8eVaY161pS4V3CBAUWtyYWsMBbj+RgxzqTaY1Z+efoMc0Lf7UzyY+RvOaEbGQxKhqjS HKvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=gw9tTNHR6HjZNbFEnB4uq2GpdB/ZKXuM9/ykZ5FJQjw=; b=Q+FWGWPzHmXWoUx620dYRk2zWIYkCsaVMQ4sxvkzo/TOdSAzMSeHhKqQpPwcPDv6iH UKY+g1BS/ESj/eEqvyvKnmKiPRTS31KPKkJfO1MNpG4y9N5ajd/dRRn3ADtKyLolV/Of pKUZERHABWakZFPFOBKwuEXoRklyYG6pYngw1LlYwUS/1ridtckmUsZm6f0+a6yYwiJm 9GGsgKWJ49UG31pqRvg5aLscnQuqpZ+E4WzU6Ulm8w1gtzTbSApYFsiCUIbGZMBV+FNZ JvnN+ouIMsR6whcSKwf6rkUtSylrklfJGL/yc1UmXvzuyeO3WClq0zkkyxbAKoGylRdq XO3g== Received: by 10.236.189.36 with SMTP id b24mr43949593yhn.9.1342059146088; Wed, 11 Jul 2012 19:12:26 -0700 (PDT) Received: by 10.236.189.36 with SMTP id b24mr43949575yhn.9.1342059146028; Wed, 11 Jul 2012 19:12:26 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id i27si1001711yhe.4.2012.07.11.19.12.26 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 11 Jul 2012 19:12:26 -0700 (PDT) Received: from toddpoynor2.mtv.corp.google.com (toddpoynor2.mtv.corp.google.com [172.18.104.48]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id E57A4100047; Wed, 11 Jul 2012 19:12:25 -0700 (PDT) Received: by toddpoynor2.mtv.corp.google.com (Postfix, from userid 115684) id 7B6FF144A12; Wed, 11 Jul 2012 19:12:25 -0700 (PDT) From: Todd Poynor To: Ben Dooks , Kukjin Kim Subject: [PATCH] ARM: samsung: adc: fix race in s3c_adc_start Date: Wed, 11 Jul 2012 19:12:11 -0700 Message-Id: <1342059131-31251-1-git-send-email-toddpoynor@google.com> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQnG+p+nfdX+Xg8TlwLf/nlIrqs6MAwCPjhBN29UNSxi0noH/VNdjE66NCPj7qWLGLNoLRRHtQbSqYTyg35Oz6H3cKJTqL9MOdPs5Ryy1MTEy4SdC4mVNEyv3pn4pK+oPRg5ZOeVWvIE5P5ibfJittzUJ6grCoiwR+JTI7rvjp7dYvnwZ2YICOINom0joXbx0CFLBT2cq0MEiNSBYXCmkmYFGQnSFA== X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.73 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: eunki_kim@samsung.com, Todd Poynor , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Checking for adc->ts_pend already claimed should be done with the lock held. Change-Id: Ic9f15e26bd19934ab8c2885ce5df265933ac304a Signed-off-by: Todd Poynor Acked-by: Ben Dooks --- 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;