linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] rtc: ds1511: drop useless checks
@ 2024-02-27 23:04 alexandre.belloni
  2024-02-27 23:04 ` [PATCH 02/12] rtc: ds1511: drop useless computation alexandre.belloni
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: alexandre.belloni @ 2024-02-27 23:04 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

The RTC core will always pass a valid rtc_tm, it is unnecessary to check
the validity of its members, especially with an open coded version of
rtc_valid_tm().

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ds1511.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 1109cad83838..87c52d20d31a 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -182,9 +182,6 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
 	if (rtc_tm->tm_year < 1900)
 		rtc_tm->tm_year += 1900;
 
-	if (rtc_tm->tm_year < 1970)
-		return -EINVAL;
-
 	yrs = rtc_tm->tm_year % 100;
 	cen = rtc_tm->tm_year / 100;
 	mon = rtc_tm->tm_mon + 1;   /* tm_mon starts at zero */
@@ -194,15 +191,6 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
 	min = rtc_tm->tm_min;
 	sec = rtc_tm->tm_sec;
 
-	if ((mon > 12) || (day == 0))
-		return -EINVAL;
-
-	if (day > rtc_month_days(rtc_tm->tm_mon, rtc_tm->tm_year))
-		return -EINVAL;
-
-	if ((hrs >= 24) || (min >= 60) || (sec >= 60))
-		return -EINVAL;
-
 	/*
 	 * each register is a different number of valid bits
 	 */
-- 
2.43.0


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

end of thread, other threads:[~2024-02-27 23:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 23:04 [PATCH 01/12] rtc: ds1511: drop useless checks alexandre.belloni
2024-02-27 23:04 ` [PATCH 02/12] rtc: ds1511: drop useless computation alexandre.belloni
2024-02-27 23:04 ` [PATCH 03/12] rtc: ds1511: drop dead code alexandre.belloni
2024-02-27 23:04 ` [PATCH 04/12] rtc: ds1511: drop useless enum alexandre.belloni
2024-02-27 23:04 ` [PATCH 05/12] rtc: ds1511: fix function definition alexandre.belloni
2024-02-27 23:04 ` [PATCH 06/12] rtc: ds1511: remove incomplete UIE support alexandre.belloni
2024-02-27 23:04 ` [PATCH 07/12] rtc: ds1511: remove ds1511_rtc_update_alarm alexandre.belloni
2024-02-27 23:04 ` [PATCH 08/12] rtc: ds1511: let the core know when alarm are not supported alexandre.belloni
2024-02-27 23:04 ` [PATCH 09/12] rtc: ds1511: remove partial alarm support alexandre.belloni
2024-02-27 23:04 ` [PATCH 10/12] rtc: ds1511: implement ds1511_rtc_read_alarm properly alexandre.belloni
2024-02-27 23:04 ` [PATCH 11/12] rtc: ds1511: rename pdata alexandre.belloni
2024-02-27 23:04 ` [PATCH 12/12] rtc: ds1511: drop inline/noinline hints alexandre.belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).