aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds2007-03-07 19:04:21 -0800
committerLinus Torvalds2007-03-07 19:04:21 -0800
commit06aa5b4aae223ea4d623dc68e85466174bb92c84 (patch)
tree22b40cd55396e5329fe8cf69907a1af13145f8bd /drivers
parentc91a32503d9ff8079cc45fa743d428fd705042dd (diff)
parentb2e569d876e153365b01525a102b7d90bb309446 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] ARC: Fix several compiler warnings. [MIPS] ISA: Fix typo [CHAR] ds1286: Fix handling of seconds in RTC_ALM_SET ioctl.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/ds1286.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index 6d58b0370802..59146e3365ba 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);