aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/cros_ec_dev.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2019-02-06 18:39:59 +0100
committerLee Jones <lee.jones@linaro.org>2019-02-07 10:44:24 +0000
commitc1778e5819a9784b5551cf8f7abd66571c1239e2 (patch)
tree195e122b9ecf24edc85eddd729df532449f83b9d /drivers/mfd/cros_ec_dev.c
parentmfd: tps68470: Drop unused MODULE_DEVICE_TABLE (diff)
downloadlinux-dev-c1778e5819a9784b5551cf8f7abd66571c1239e2.tar.xz
linux-dev-c1778e5819a9784b5551cf8f7abd66571c1239e2.zip
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: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Benson Leung <bleung@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/cros_ec_dev.c')
-rw-r--r--drivers/mfd/cros_ec_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index ed809fc97df8..d275deaecb12 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -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)))
return -EFAULT;
- return 0;
+ return num;
}
static long ec_device_ioctl(struct file *filp, unsigned int cmd,