summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-06 21:12:32 +0200
committerThomas Gleixner <tglx@linutronix.de>2011-06-06 21:12:32 +0200
commitf6509b5f002a69c299b04d32a876d051a0b52f68 (patch)
tree322d0d244376fd74d26f90a9c54aaf5d49b69f09 /drivers
parent4bcbfff618f92f770dff28c8d3320fc96acf52df (diff)
parentfb5a18cf7c771a12c3f42a5eb4b476eed68b77cb (diff)
downloadlinux-f6509b5f002a69c299b04d32a876d051a0b52f68.tar.gz
linux-f6509b5f002a69c299b04d32a876d051a0b52f68.tar.bz2
linux-f6509b5f002a69c299b04d32a876d051a0b52f68.zip
Merge branch 'fortglx/3.0/tip/timers/ptp' of git://git.linaro.org/people/jstultz/linux into timers/urgent
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ptp/ptp_chardev.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index a8d03aeb4051..e7f301da2902 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -46,7 +46,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
caps.n_ext_ts = ptp->info->n_ext_ts;
caps.n_per_out = ptp->info->n_per_out;
caps.pps = ptp->info->pps;
- err = copy_to_user((void __user *)arg, &caps, sizeof(caps));
+ if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
+ err = -EFAULT;
break;
case PTP_EXTTS_REQUEST:
@@ -129,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
return -ERESTARTSYS;
}
- if (ptp->defunct)
+ if (ptp->defunct) {
+ mutex_unlock(&ptp->tsevq_mux);
return -ENODEV;
+ }
spin_lock_irqsave(&queue->lock, flags);
@@ -150,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
mutex_unlock(&ptp->tsevq_mux);
- if (copy_to_user(buf, event, cnt)) {
- mutex_unlock(&ptp->tsevq_mux);
+ if (copy_to_user(buf, event, cnt))
return -EFAULT;
- }
return cnt;
}