Bug 7361

Summary: bug in rtc-max6902.c
Product: Drivers Reporter: Francisco Larramendi (flarramendi)
Component: OtherAssignee: drivers_other
Status: RESOLVED CODE_FIX    
Severity: normal    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.19-rc2 and previous Subsystem:
Regression: --- Bisected commit-id:

Description Francisco Larramendi 2006-10-13 12:50:26 UTC
Most recent kernel where this bug did not occur:
Distribution:
Hardware Environment:
Software Environment:
Problem Description:
hwclock returns an improper date reading a max6902 rtc in october 

Steps to reproduce:
In a machine with a max6902 rtc, in october, just run hwclok

Fix:
In drivers/rtc/rtc-max6902.c, function max6902_get_datetime, line 139:

dt->tm_mon      = BCD2BIN(chip->buf[5] - 1);

should be replaced for:

dt->tm_mon      = BCD2BIN(chip->buf[5]) - 1;

Explanetion: first convert to binary and then decrement.
Fortunately is only detectable in october.
Comment 1 Andrew Morton 2006-10-13 13:24:28 UTC
I queued a fix, thanks.