Commit 35b1da4e authored by Axel Lin's avatar Axel Lin Committed by Dmitry Torokhov

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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 30ebb7fa
...@@ -566,9 +566,12 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *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); read = min_t(size_t, count, tsdata->raw_bufsize - *off);
error = copy_to_user(buf, tsdata->raw_buffer + *off, read); if (copy_to_user(buf, tsdata->raw_buffer + *off, read)) {
if (!error) error = -EFAULT;
*off += read; goto out;
}
*off += read;
out: out:
mutex_unlock(&tsdata->mutex); mutex_unlock(&tsdata->mutex);
return error ?: read; return error ?: read;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment