All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH 1/1] rtc: ds1685: correct check of day of month
@ 2016-05-18 19:09 ` Heinrich Schuchardt
  0 siblings, 0 replies; 8+ messages in thread
From: Heinrich Schuchardt @ 2016-05-18 19:09 UTC (permalink / raw)
  To: Joshua Kinard, Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux, linux-kernel, Heinrich Schuchardt

Operator ! has a higher priority than &&.
(!(mday >= 1) && (mday <= 31)) is false for mday == 32.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/rtc/rtc-ds1685.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index b3ce3c6..b4fae3c 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -389,7 +389,7 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	ds1685_rtc_end_data_access(rtc);
 
 	/* Check month date. */
-	if (!(mday >= 1) && (mday <= 31))
+	if ((mday < 1) || (mday > 31))
 		return -EDOM;
 
 	/*
@@ -461,7 +461,7 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 				     RTC_MDAY_BCD_MASK);
 
 	/* Check the month date for validity. */
-	if (!(mday >= 1) && (mday <= 31))
+	if ((mday < 1) || (mday > 31))
 		return -EDOM;
 
 	/*
-- 
2.1.4

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

end of thread, other threads:[~2016-06-04 13:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 19:09 [rtc-linux] [PATCH 1/1] rtc: ds1685: correct check of day of month Heinrich Schuchardt
2016-05-18 19:09 ` Heinrich Schuchardt
2016-05-20 22:38 ` [rtc-linux] " Alexandre Belloni
2016-05-20 22:38   ` Alexandre Belloni
2016-05-21 22:18   ` [rtc-linux] [PATCH v2 " Heinrich Schuchardt
2016-05-21 22:18     ` Heinrich Schuchardt
2016-06-04 13:46     ` [rtc-linux] " Alexandre Belloni
2016-06-04 13:46       ` Alexandre Belloni

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.