From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Sasha Levin <sashal@kernel.org>,
linux-rtc@vger.kernel.org
Subject: [PATCH AUTOSEL 3.18 02/10] rtc: sh: Fix invalid alarm warning for non-enabled alarm
Date: Wed, 24 Apr 2019 10:52:51 -0400 [thread overview]
Message-ID: <20190424145259.31639-2-sashal@kernel.org> (raw)
In-Reply-To: <20190424145259.31639-1-sashal@kernel.org>
From: Geert Uytterhoeven <geert+renesas@glider.be>
[ Upstream commit 15d82d22498784966df8e4696174a16b02cc1052 ]
When no alarm has been programmed on RSK-RZA1, an error message is
printed during boot:
rtc rtc0: invalid alarm value: 2019-03-14T255:255:255
sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm
field that is not enabled. __rtc_read_alarm() validates the received
alarm values, and fills in missing fields when needed.
While 0xff is handled fine for the year, month, and day fields, and
corrected as considered being out-of-range, this is not the case for the
hour, minute, and second fields, where -1 is expected for missing
fields.
Fix this by returning -1 instead, as this value is handled fine for all
fields.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/rtc/rtc-sh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index d0d2b047658b..dcd5dcae7b3c 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -455,7 +455,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)
{
unsigned int byte;
- int value = 0xff; /* return 0xff for ignored values */
+ int value = -1; /* return -1 for ignored values */
byte = readb(rtc->regbase + reg_off);
if (byte & AR_ENB) {
--
2.19.1
next prev parent reply other threads:[~2019-04-24 14:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 14:52 [PATCH AUTOSEL 3.18 01/10] HID: debug: fix race condition with between rdesc_show() and device removal Sasha Levin
2019-04-24 14:52 ` Sasha Levin [this message]
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 03/10] igb: Fix WARN_ONCE on runtime suspend Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 04/10] bonding: show full hw address in sysfs for slave entries Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 05/10] jffs2: fix use-after-free on symlink traversal Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 06/10] scsi: storvsc: Fix calculation of sub-channel count Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 07/10] hugetlbfs: fix memory leak for resv_map Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 08/10] xsysace: Fix error handling in ace_setup Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 09/10] ARM: orion: don't use using 64-bit DMA masks Sasha Levin
2019-04-24 14:52 ` [PATCH AUTOSEL 3.18 10/10] ARM: iop: " Sasha Levin
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=20190424145259.31639-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).