stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 4.9 03/28] rtc: sh: Fix invalid alarm warning for non-enabled alarm
Date: Wed, 24 Apr 2019 10:49:47 -0400	[thread overview]
Message-ID: <20190424145012.30886-3-sashal@kernel.org> (raw)
In-Reply-To: <20190424145012.30886-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 17b6235d67a5..600fb7f93939 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -454,7 +454,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


  parent reply	other threads:[~2019-04-24 14:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 14:49 [PATCH AUTOSEL 4.9 01/28] HID: logitech: check the return value of create_singlethread_workqueue Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 02/28] HID: debug: fix race condition with between rdesc_show() and device removal Sasha Levin
2019-04-24 14:49 ` Sasha Levin [this message]
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 04/28] batman-adv: Reduce claim hash refcnt only for removed entry Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 05/28] batman-adv: Reduce tt_local " Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 06/28] batman-adv: Reduce tt_global " Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 07/28] igb: Fix WARN_ONCE on runtime suspend Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 08/28] fm10k: Fix a potential NULL pointer dereference Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 09/28] net/mlx5: E-Switch, Fix esw manager vport indication for more vport commands Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 10/28] bonding: show full hw address in sysfs for slave entries Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 11/28] net: stmmac: don't overwrite discard_frame status Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 12/28] net: stmmac: fix dropping of multi-descriptor RX frames Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 13/28] net: stmmac: don't log oversized frames Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 14/28] jffs2: fix use-after-free on symlink traversal Sasha Levin
2019-04-24 14:49 ` [PATCH AUTOSEL 4.9 15/28] debugfs: " Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 16/28] rtc: da9063: set uie_unsupported when relevant Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 17/28] vfio/pci: use correct format characters Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 18/28] scsi: core: add new RDAC LENOVO/DE_Series device Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 19/28] scsi: storvsc: Fix calculation of sub-channel count Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 20/28] net: hns: fix KASAN: use-after-free in hns_nic_net_xmit_hw() Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 21/28] net: hns: Use NAPI_POLL_WEIGHT for hns driver Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 22/28] net: hns: Fix WARNING when remove HNS driver with SMMU enabled Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 23/28] hugetlbfs: fix memory leak for resv_map Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 24/28] sh: fix multiple function definition build errors Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 25/28] kernel/sysctl.c: fix out-of-bounds access when setting file-max Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 26/28] xsysace: Fix error handling in ace_setup Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 27/28] ARM: orion: don't use using 64-bit DMA masks Sasha Levin
2019-04-24 14:50 ` [PATCH AUTOSEL 4.9 28/28] 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=20190424145012.30886-3-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).