mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform: chrome: cros_ec_dev - Return number of bytes read with CROS_EC_DEV_IOCRDMEM
@ 2016-04-05 19:17 Guenter Roeck
  0 siblings, 0 replies; only message in thread
From: Guenter Roeck @ 2016-04-05 19:17 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linux-kernel, Guenter Roeck, Gwendal Grignou

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.

Cc: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/platform/chrome/cros_ec_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
index d45cd254ed1c..6c45e0f5ba7b 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -181,7 +181,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,
-- 
2.5.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-05 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 19:17 [PATCH] platform: chrome: cros_ec_dev - Return number of bytes read with CROS_EC_DEV_IOCRDMEM Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®