aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_chardev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ptp/ptp_chardev.c')
-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)
46 caps.n_ext_ts = ptp->info->n_ext_ts; 46 caps.n_ext_ts = ptp->info->n_ext_ts;
47 caps.n_per_out = ptp->info->n_per_out; 47 caps.n_per_out = ptp->info->n_per_out;
48 caps.pps = ptp->info->pps; 48 caps.pps = ptp->info->pps;
49 err = copy_to_user((void __user *)arg, &caps, sizeof(caps)); 49 if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
50 err = -EFAULT;
50 break; 51 break;
51 52
52 case PTP_EXTTS_REQUEST: 53 case PTP_EXTTS_REQUEST:
@@ -129,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
129 return -ERESTARTSYS; 130 return -ERESTARTSYS;
130 } 131 }
131 132
132 if (ptp->defunct) 133 if (ptp->defunct) {
134 mutex_unlock(&ptp->tsevq_mux);
133 return -ENODEV; 135 return -ENODEV;
136 }
134 137
135 spin_lock_irqsave(&queue->lock, flags); 138 spin_lock_irqsave(&queue->lock, flags);
136 139
@@ -150,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
150 153
151 mutex_unlock(&ptp->tsevq_mux); 154 mutex_unlock(&ptp->tsevq_mux);
152 155
153 if (copy_to_user(buf, event, cnt)) { 156 if (copy_to_user(buf, event, cnt))
154 mutex_unlock(&ptp->tsevq_mux);
155 return -EFAULT; 157 return -EFAULT;
156 }
157 158
158 return cnt; 159 return cnt;
159} 160}