Patch "rtc: pcf85063: Fix reading alarm" has been added to the 5.10-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: pcf85063: Fix reading alarm

to the 5.10-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-pcf85063-fix-reading-alarm.patch
and it can be found in the queue-5.10 subdirectory.

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



commit ca08b300acfa82682c2e23c2772f899e00dd35d1
Author: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
Date:   Wed Sep 21 09:41:41 2022 +0200

    rtc: pcf85063: Fix reading alarm
    
    [ Upstream commit a6ceee26fd5ed9b5bd37322b1ca88e4548cee4a3 ]
    
    If the alarms are disabled the topmost bit (AEN_*) is set in the alarm
    registers. This is also interpreted in BCD number leading to this warning:
    rtc rtc0: invalid alarm value: 2022-09-21T80:80:80
    
    Fix this by masking alarm enabling and reserved bits.
    
    Fixes: 05cb3a56ee8c ("rtc: pcf85063: add alarm support")
    Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220921074141.3903104-1-alexander.stein@xxxxxxxxxxxxxxx
    Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 62684ca3a665..d739b0c965aa 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -167,10 +167,10 @@ static int pcf85063_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	if (ret)
 		return ret;
 
-	alrm->time.tm_sec = bcd2bin(buf[0]);
-	alrm->time.tm_min = bcd2bin(buf[1]);
-	alrm->time.tm_hour = bcd2bin(buf[2]);
-	alrm->time.tm_mday = bcd2bin(buf[3]);
+	alrm->time.tm_sec = bcd2bin(buf[0] & 0x7f);
+	alrm->time.tm_min = bcd2bin(buf[1] & 0x7f);
+	alrm->time.tm_hour = bcd2bin(buf[2] & 0x3f);
+	alrm->time.tm_mday = bcd2bin(buf[3] & 0x3f);
 
 	ret = regmap_read(pcf85063->regmap, PCF85063_REG_CTRL2, &val);
 	if (ret)



[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