Skip to content

Commit e34494c

Browse files
Kars-de-Jongalexandrebelloni
authored andcommitted
rtc: msm6242: Fix reading of 10-hour digit
The driver was reading the wrong register as the 10-hour digit due to a misplaced ')'. It was in fact reading the 1-second digit register due to this bug. Also remove the use of a magic number for the hour mask and use the define for it which was already present. Fixes: 4f9b9bb ("rtc: Add an RTC driver for the Oki MSM6242") Tested-by: Kars de Jong <[email protected]> Signed-off-by: Kars de Jong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
1 parent db96d57 commit e34494c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/rtc/rtc-msm6242.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm)
133133
msm6242_read(priv, MSM6242_SECOND1);
134134
tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 +
135135
msm6242_read(priv, MSM6242_MINUTE1);
136-
tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 +
136+
tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) &
137+
MSM6242_HOUR10_HR_MASK) * 10 +
137138
msm6242_read(priv, MSM6242_HOUR1);
138139
tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 +
139140
msm6242_read(priv, MSM6242_DAY1);

0 commit comments

Comments
 (0)