Re: [PATCH] serdev: fix serdev_device_write_buf() return value

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

 



On Wed, May 17, 2017 at 02:39:51PM +0200, Lucas Stach wrote:
> 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>

This was reported and discussed here:

	https://marc.info/?l=linux-serial&m=149368424111761&w=2

and will end up being fixed by reverting the serdev_device_write_buf
wrapper change:

	https://lkml.kernel.org/r/1493380041-14710-1-git-send-email-stefan.wahren@xxxxxxxx

> ---
>  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 */

So this will one will not be needed.

Thanks,
Johan
--
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