]> Git Repo - linux.git/commitdiff
Input: edt-ft5x06 - return -EFAULT on copy_to_user() error
authorAxel Lin <[email protected]>
Wed, 19 Sep 2012 22:56:23 +0000 (15:56 -0700)
committerDmitry Torokhov <[email protected]>
Wed, 19 Sep 2012 23:00:26 +0000 (16:00 -0700)
copy_to_user() returns the number of bytes remaining, but we want a
negative error code here.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
drivers/input/touchscreen/edt-ft5x06.c

index b06a5e3a665ea1864c8824f6d7d172f87d0b3ac1..64957770b52209fcc527e3f015e21816b3165bc7 100644 (file)
@@ -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;
This page took 0.055948 seconds and 4 git commands to generate.