Skip to contentSkip to conversation

Input: edt-ft5x06 - return -EFAULT on copy_to_user() error

PATCH New Axel Lin 1 participant 1 message Sep 17, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/input/touchscreen/edt-ft5x06.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/input/touchscreen/edt-ft5x06.c +3 -1
index bf00b32..02e9dab 100644
@@ -567,7 +567,9 @@ 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)
+	if (error)
+		error = -EFAULT;
+	else
 		*off += read;
 out:
 	mutex_unlock(&tsdata->mutex);
Signature · 1 line
1.7.9.5