Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b35692ebdef0c1cd4a05a58559a94ced54ff9c82 Commit: b35692ebdef0c1cd4a05a58559a94ced54ff9c82 Parent: 455921451a176d90c5cfef898f061bb6fc83faaf Author: Ralf Baechle <[EMAIL PROTECTED]> AuthorDate: Thu Mar 8 00:14:25 2007 +0000 Committer: Ralf Baechle <[EMAIL PROTECTED]> CommitDate: Thu Mar 8 01:10:30 2007 +0000
[CHAR] ds1286: Fix handling of seconds in RTC_ALM_SET ioctl. o Fix use of uninitialized variable sec. o Make the RTC_ALM_SET ioctl return -EINVAL for non-zero seconds - the DS1286 has no second field for the alarm time. o Replace the obscure BIN_TO_BCD macro with BIN2BCD. Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]> --- drivers/char/ds1286.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index 6d58b03..59146e3 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c @@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, hrs = alm_tm.tm_hour; min = alm_tm.tm_min; + sec = alm_tm.tm_sec; if (hrs >= 24) hrs = 0xff; @@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, if (min >= 60) min = 0xff; - BIN_TO_BCD(sec); - BIN_TO_BCD(min); - BIN_TO_BCD(hrs); + if (sec != 0) + return -EINVAL; + + min = BIN2BCD(min); + min = BIN2BCD(hrs); spin_lock(&ds1286_lock); rtc_write(hrs, RTC_HOURS_ALARM); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html