* [PATCH] rtc: fix error return in pm80x_rtc_set_alarm()
@ 2025-10-02 9:16 Alexandr Sapozhnkiov
0 siblings, 0 replies; only message in thread
From: Alexandr Sapozhnkiov @ 2025-10-02 9:16 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 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
index f40cc06b0979..f26d8a1e827b 100644
--- a/drivers/rtc/rtc-88pm80x.c
+++ b/drivers/rtc/rtc-88pm80x.c
@@ -173,17 +173,21 @@ static int pm80x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
struct rtc_time now_tm, alarm_tm;
unsigned long ticks, base, data;
unsigned char buf[4];
- int mask;
+ int mask, ret;
regmap_update_bits(info->map, PM800_RTC_CONTROL, PM800_ALARM1_EN, 0);
- regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
+ ret = regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
+ if (ret)
+ return ret;
base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
(buf[1] << 8) | buf[0];
dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]);
/* 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];
ticks = base + data;
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-02 9:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 9:16 [PATCH] rtc: fix error return in pm80x_rtc_set_alarm() Alexandr Sapozhnkiov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox