summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/edt-ft5x06.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-09-20 00:56:23 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-09-20 01:00:26 +0200
commit35b1da4e1e1026b5195649170dfb9ebb52f808e0 (patch)
treefe750def61a997737f1ed5f8d58b6835f05b0dc6 /drivers/input/touchscreen/edt-ft5x06.c
parentInput: sentelic - filter out erratic movement when lifting finger (diff)
downloadlinux-35b1da4e1e1026b5195649170dfb9ebb52f808e0.tar.xz
linux-35b1da4e1e1026b5195649170dfb9ebb52f808e0.zip
Input: edt-ft5x06 - return -EFAULT on copy_to_user() error
copy_to_user() returns the number of bytes remaining, but we want a negative error code here. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/edt-ft5x06.c')
-rw-r--r--drivers/input/touchscreen/edt-ft5x06.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index b06a5e3a665e..64957770b522 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -566,9 +566,12 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
}
read = min_t(size_t, count, tsdata->raw_bufsize - *off);
- error = copy_to_user(buf, tsdata->raw_buffer + *off, read);
- if (!error)
- *off += read;
+ if (copy_to_user(buf, tsdata->raw_buffer + *off, read)) {
+ error = -EFAULT;
+ goto out;
+ }
+
+ *off += read;
out:
mutex_unlock(&tsdata->mutex);
return error ?: read;