linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: fix error return in pm80x_rtc_set_time()
@ 2025-10-02  9:19 Alexandr Sapozhnkiov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandr Sapozhnkiov @ 2025-10-02  9:19 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc, linux-kernel
  Cc: Alexandr Sapozhnikov, lvc-project

From: Alexandr Sapozhnikov <alsp705@gmail.com>

The regmap_raw_write() function may return an error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
---
 drivers/rtc/rtc-88pm80x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
index f40cc06b0979..71d4cc7e595c 100644
--- a/drivers/rtc/rtc-88pm80x.c
+++ b/drivers/rtc/rtc-88pm80x.c
@@ -136,9 +136,7 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	buf[1] = (base >> 8) & 0xFF;
 	buf[2] = (base >> 16) & 0xFF;
 	buf[3] = (base >> 24) & 0xFF;
-	regmap_raw_write(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
-
-	return 0;
+	return regmap_raw_write(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
 }
 
 static int pm80x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
-- 
2.43.0


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

* [PATCH] rtc: fix error return in pm80x_rtc_set_time()
@ 2025-10-02  9:20 Alexandr Sapozhnkiov
  2025-10-03 14:08 ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandr Sapozhnkiov @ 2025-10-02  9:20 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc, linux-kernel
  Cc: Alexandr Sapozhnikov, lvc-project

From: Alexandr Sapozhnikov <alsp705@gmail.com>

The regmap_raw_read() function may return an error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
---
 drivers/rtc/rtc-88pm80x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
index f40cc06b0979..50266d2e078a 100644
--- a/drivers/rtc/rtc-88pm80x.c
+++ b/drivers/rtc/rtc-88pm80x.c
@@ -119,6 +119,7 @@ static int pm80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
+	int ret;
 	struct pm80x_rtc_info *info = dev_get_drvdata(dev);
 	unsigned char buf[4];
 	unsigned long ticks, base, data;
@@ -126,7 +127,9 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	ticks = rtc_tm_to_time64(tm);
 
 	/* load 32-bit read-only counter */
-	regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4);
+	ret = regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4);
+	if (ret)
+		return ret;
 	data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
 		(buf[1] << 8) | buf[0];
 	base = ticks - data;
-- 
2.43.0


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

* Re: [PATCH] rtc: fix error return in pm80x_rtc_set_time()
  2025-10-02  9:20 Alexandr Sapozhnkiov
@ 2025-10-03 14:08 ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-10-03 14:08 UTC (permalink / raw)
  To: Alexandr Sapozhnikov, linux-rtc, lvc-project; +Cc: LKML, Alexandre Belloni

> The regmap_raw_read() function may return an error.

* Would you like to choose another imperative wording for an improved change description?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n94

* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?


Regards,
Markus

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

end of thread, other threads:[~2025-10-03 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02  9:19 [PATCH] rtc: fix error return in pm80x_rtc_set_time() Alexandr Sapozhnkiov
  -- strict thread matches above, loose matches on Subject: below --
2025-10-02  9:20 Alexandr Sapozhnkiov
2025-10-03 14:08 ` Markus Elfring

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).