public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re-send of patch to broader audience
@ 2013-06-06 17:46 cbrand
  2013-06-06 17:46 ` [PATCH] RTC: Return -EBUSY, not -EACCES when device is busy cbrand
  2013-06-06 17:54 ` Re-send of patch to broader audience Alessandro Zummo
  0 siblings, 2 replies; 3+ messages in thread
From: cbrand @ 2013-06-06 17:46 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel

I originally sent this patch 4 Apr [1] and 17 Apr [2] to the rtc
mailing list and maintainer, but saw no responses. I think it's
pretty clear that the original code is wrong.

Hopefully third time's the charm...

Chris

[1] https://groups.google.com/forum/?fromgroups=#!topic/rtc-linux/GrsRzUH1ORc
[2] https://groups.google.com/forum/?fromgroups=#!topic/rtc-linux/R3U764kTnhU


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] RTC: Return -EBUSY, not -EACCES when device is busy
  2013-06-06 17:46 Re-send of patch to broader audience cbrand
@ 2013-06-06 17:46 ` cbrand
  2013-06-06 17:54 ` Re-send of patch to broader audience Alessandro Zummo
  1 sibling, 0 replies; 3+ messages in thread
From: cbrand @ 2013-06-06 17:46 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel; +Cc: Chris Brand

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Re-send of patch to broader audience
  2013-06-06 17:46 Re-send of patch to broader audience cbrand
  2013-06-06 17:46 ` [PATCH] RTC: Return -EBUSY, not -EACCES when device is busy cbrand
@ 2013-06-06 17:54 ` Alessandro Zummo
  1 sibling, 0 replies; 3+ messages in thread
From: Alessandro Zummo @ 2013-06-06 17:54 UTC (permalink / raw)
  To: cbrand; +Cc: rtc-linux, linux-kernel, akpm

On Thu, 6 Jun 2013 10:46:08 -0700
cbrand@broadcom.com wrote:

> I originally sent this patch 4 Apr [1] and 17 Apr [2] to the rtc
> mailing list and maintainer, but saw no responses. I think it's
> pretty clear that the original code is wrong.

 Hi, your patch seems reasonable to me.

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-06 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06 17:46 Re-send of patch to broader audience cbrand
2013-06-06 17:46 ` [PATCH] RTC: Return -EBUSY, not -EACCES when device is busy cbrand
2013-06-06 17:54 ` Re-send of patch to broader audience Alessandro Zummo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox