Commit c1778e58 authored by Guenter Roeck's avatar Guenter Roeck Committed by Lee Jones

mfd: cros_ec_dev: Return number of bytes read with CROS_EC_DEV_IOCRDMEM

While ioctls normally return a negative error or 0 on success, this is not
the case for CROS_EC_DEV_IOCXCMD in the cros_ec driver, which returns the
number of bytes read instead. However, CROS_EC_DEV_IOCRDMEM in the same
driver does not return the number of byte read on success. This is both
inconsistent and problematic, since the amount of returned data can be
dynamic. Have it return the number of data bytes for consistency.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 66265e71
...@@ -224,7 +224,7 @@ static long ec_device_ioctl_readmem(struct cros_ec_dev *ec, void __user *arg) ...@@ -224,7 +224,7 @@ static long ec_device_ioctl_readmem(struct cros_ec_dev *ec, void __user *arg)
if (copy_to_user((void __user *)arg, &s_mem, sizeof(s_mem))) if (copy_to_user((void __user *)arg, &s_mem, sizeof(s_mem)))
return -EFAULT; return -EFAULT;
return 0; return num;
} }
static long ec_device_ioctl(struct file *filp, unsigned int cmd, static long ec_device_ioctl(struct file *filp, unsigned int cmd,
......
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