All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <12o3l@tiscali.nl>
To: a.zummo@towertech.it
Cc: rtc-linux@googlegroups.com, lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/6] RTC: rtc-ds1374: fix unsigned new_alarm test
Date: Wed, 16 Apr 2008 17:32:28 +0200	[thread overview]
Message-ID: <48061C0C.2020406@tiscali.nl> (raw)
In-Reply-To: <48061AFC.9050106@tiscali.nl>

Sorry for the duplicate, I forgot to fix the email header
---
New_alarm is unsigned so the test didn't work.
    
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 45bda18..119bdc9 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -216,16 +216,16 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	rtc_tm_to_time(&alarm->time, &new_alarm);
 	rtc_tm_to_time(&now, &itime);
 
-	new_alarm -= itime;
-
 	/* This can happen due to races, in addition to dates that are
 	 * truly in the past.  To avoid requiring the caller to check for
 	 * races, dates in the past are assumed to be in the recent past
 	 * (i.e. not something that we'd rather the caller know about via
 	 * an error), and the alarm is set to go off as soon as possible.
 	 */
-	if (new_alarm <= 0)
+	if (new_alarm <= itime)
 		new_alarm = 1;
+	else
+		new_alarm -= itime;
 
 	mutex_lock(&ds1374->mutex);
 


  reply	other threads:[~2008-04-16 15:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16  1:39 [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0 Roel Kluin
2008-04-16 15:27 ` Roel Kluin
2008-04-16 15:32   ` Roel Kluin [this message]
2008-04-18 21:58     ` [PATCH 4/6] RTC: rtc-ds1374: fix unsigned new_alarm test Alessandro Zummo
2008-04-16 16:00 ` [PATCH 5/6] NETFILTER: signed tcphoff for ipv6_skip_exthdr() retval Roel Kluin
2008-04-21 12:24   ` [netfilter-core] " Patrick McHardy
2008-04-16 16:20 ` [PATCH 6/6] sound/drivers/dummy.c: fix negative snd_pcm_format_width() check Roel Kluin
2008-04-16 16:31   ` Takashi Iwai
2008-04-16 16:31     ` [alsa-devel] " Takashi Iwai
2008-04-16 18:00 ` [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0 Ralf Baechle
2008-04-16 19:39 ` Marcin Slusarz

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=48061C0C.2020406@tiscali.nl \
    --to=12o3l@tiscali.nl \
    --cc=a.zummo@towertech.it \
    --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 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.