mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cbrand@broadcom.com
To: a.zummo@towertech.it, rtc-linux@googlegroups.com,
	linux-kernel@vger.kernel.org
Cc: "Chris Brand" <chris.brand@broadcom.com>
Subject: [PATCH] RTC: Return -EBUSY, not -EACCES when device is busy
Date: Thu, 6 Jun 2013 10:46:09 -0700	[thread overview]
Message-ID: <1370540769-2466-2-git-send-email-cbrand@broadcom.com> (raw)
In-Reply-To: <1370540769-2466-1-git-send-email-cbrand@broadcom.com>

From: Chris Brand <chris.brand@broadcom.com>

If rtc->irq_task is non-NULL and task is NULL, they always
differ, which means that in rtc_irq_set_state() and
rtc_irq_set_freq(), whenever err is set to -EBUSY it will
then immediately be set to -EACCES, misleading the caller
as to the underlying problem.
---
 drivers/rtc/interface.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 42bd57d..40d4032 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -698,9 +698,9 @@ retry:
 	spin_lock_irqsave(&rtc->irq_task_lock, flags);
 	if (rtc->irq_task != NULL && task == NULL)
 		err = -EBUSY;
-	if (rtc->irq_task != task)
+	else if (rtc->irq_task != task)
 		err = -EACCES;
-	if (!err) {
+	else {
 		if (rtc_update_hrtimer(rtc, enabled) < 0) {
 			spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
 			cpu_relax();
@@ -734,9 +734,9 @@ retry:
 	spin_lock_irqsave(&rtc->irq_task_lock, flags);
 	if (rtc->irq_task != NULL && task == NULL)
 		err = -EBUSY;
-	if (rtc->irq_task != task)
+	else if (rtc->irq_task != task)
 		err = -EACCES;
-	if (!err) {
+	else {
 		rtc->irq_freq = freq;
 		if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
 			spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
-- 
1.7.5.4



  reply	other threads:[~2013-06-06 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 17:46 Re-send of patch to broader audience cbrand
2013-06-06 17:46 ` cbrand [this message]
2013-06-06 17:54 ` Alessandro Zummo

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=1370540769-2466-2-git-send-email-cbrand@broadcom.com \
    --to=cbrand@broadcom.com \
    --cc=a.zummo@towertech.it \
    --cc=chris.brand@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome