[PATCH] serdev: fix serdev_device_write_buf() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before the re-implementation of serdev_device_write_buf() to use
serdev_device_write() internally, this function returned the number of bytes
written in case of success. serdev_device_write() instead returns 0 when
the transmission was successful, which breaks users relying on the old API.

Fixes: 6fe729c4bdae (serdev: Add serdev_device_write subroutine)
Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
---
 include/linux/serdev.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index cda76c6506ca..4ced8f177220 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -316,7 +316,10 @@ static inline int serdev_device_write_buf(struct serdev_device *serdev,
 					  const unsigned char *data,
 					  size_t count)
 {
-	return serdev_device_write(serdev, data, count, 0);
+	int ret;
+
+	ret = serdev_device_write(serdev, data, count, 0);
+	return ret ? ret : count;
 }
 
 #endif /*_LINUX_SERDEV_H */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux