summaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-07-20 14:56:40 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-07-20 14:56:40 +0000
commite308faf24f68e262d92d294a01ddca7a17e76762 (patch)
tree22c47cb315811834861f013067878ff664e95abd /drivers/char/rtc.c
parent30c6397ce63178fcb3e7963ac247f0a03132aca9 (diff)
Sync with Linux 2.1.46.
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r--drivers/char/rtc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index a8614999d..5f03f8887 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -152,7 +152,7 @@ static long rtc_read(struct inode *inode, struct file *file, char *buf,
unsigned long count)
{
struct wait_queue wait = { current, NULL };
- int retval;
+ int retval = 0;
if (count < sizeof(unsigned long))
return -EINVAL;
@@ -180,7 +180,9 @@ static long rtc_read(struct inode *inode, struct file *file, char *buf,
data = rtc_irq_data;
rtc_irq_data = 0;
restore_flags(flags);
- retval = put_user(data, (unsigned long *)buf)) ?: sizeof(unsigned long);
+ retval = put_user(data, (unsigned long *)buf);
+ if (!retval)
+ retval = sizeof(unsigned long);
}
current->state = TASK_RUNNING;
@@ -262,7 +264,6 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
* "don't care" or "match all". Only the tm_hour,
* tm_min and tm_sec are used.
*/
- int retval;
unsigned char hrs, min, sec;
struct rtc_time alm_tm;
@@ -305,7 +306,6 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
case RTC_SET_TIME: /* Set the RTC */
{
- int retval;
struct rtc_time rtc_tm;
unsigned char mon, day, hrs, min, sec, leap_yr;
unsigned char save_control, save_freq_select;
@@ -418,7 +418,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return -EINVAL;
}
- return copy_to_user(arg, &wtime, sizeof wtime) ? -EFAULT : 0;
+ return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
}
/*