Patch "rtc: interface: Add RTC offset to alarm after fix-up" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    rtc: interface: Add RTC offset to alarm after fix-up

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rtc-interface-add-rtc-offset-to-alarm-after-fix-up.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c792e0b9505ae16563b6427fc52585e622487352
Author: Csókás, Bence <csokas.bence@xxxxxxxxx>
Date:   Wed Jun 19 16:04:52 2024 +0200

    rtc: interface: Add RTC offset to alarm after fix-up
    
    [ Upstream commit 463927a8902a9f22c3633960119410f57d4c8920 ]
    
    `rtc_add_offset()` is called by `__rtc_read_time()`
    and `__rtc_read_alarm()` to add the RTC's offset to
    the raw read-outs from the device drivers. However,
    in the latter case, a fix-up algorithm is run if
    the RTC device does not report a full `struct rtc_time`
    alarm value. In that case, the offset was forgot to be
    added.
    
    Fixes: fd6792bb022e ("rtc: fix alarm read and set offset")
    
    Signed-off-by: Csókás, Bence <csokas.bence@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240619140451.2800578-1-csokas.bence@xxxxxxxxx
    Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 1b63111cdda2e..0b23706d9fd3c 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -274,10 +274,9 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 			return err;
 
 		/* full-function RTCs won't have such missing fields */
-		if (rtc_valid_tm(&alarm->time) == 0) {
-			rtc_add_offset(rtc, &alarm->time);
-			return 0;
-		}
+		err = rtc_valid_tm(&alarm->time);
+		if (!err)
+			goto done;
 
 		/* get the "after" timestamp, to detect wrapped fields */
 		err = rtc_read_time(rtc, &now);
@@ -379,6 +378,8 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 	if (err && alarm->enabled)
 		dev_warn(&rtc->dev, "invalid alarm value: %ptR\n",
 			 &alarm->time);
+	else
+		rtc_add_offset(rtc, &alarm->time);
 
 	return err;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux