rtc: fix error return in pm80x_rtc_set_time()
PATCH 1/1 rtc: fix error return in pm80x_rtc_set_time()
From: Alexandr Sapozhnikov <[email protected]>
The regmap_raw_read() function may return an error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Alexandr Sapozhnikov <[email protected]>
--- drivers/rtc/rtc-88pm80x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rtc/rtc-88pm80x.c +4 -1
@@ -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;
Signature · 1 line
2.43.0
Quoted 1 line
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