LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] hidraw: Replace Confusing += Operator with =
@ 2011-01-27  3:25 Alan Ott
  2011-01-31 14:44 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Ott @ 2011-01-27  3:25 UTC (permalink / raw)
  To: Jiri Kosina, linux-input, linux-kernel; +Cc: Alan Ott

Setting of the return value of hidraw_read() uses the += operator when
= is more appropriate.  There is no case where ret can be anything
other than zero when the assignment is made, making = equivalent to
+= and much more clear.

Signed-off-by: Alan Ott <alan@signal11.us>
---
 drivers/hid/hidraw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 468e87b..66fbcba 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -91,7 +91,7 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
 			ret = -EFAULT;
 			goto out;
 		}
-		ret += len;
+		ret = len;
 
 		kfree(list->buffer[list->tail].value);
 		list->tail = (list->tail + 1) & (HIDRAW_BUFFER_SIZE - 1);
-- 
1.7.0.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] hidraw: Replace Confusing += Operator with =
  2011-01-27  3:25 [PATCH 1/1] hidraw: Replace Confusing += Operator with = Alan Ott
@ 2011-01-31 14:44 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2011-01-31 14:44 UTC (permalink / raw)
  To: Alan Ott; +Cc: linux-input, linux-kernel

On Wed, 26 Jan 2011, Alan Ott wrote:

> Setting of the return value of hidraw_read() uses the += operator when
> = is more appropriate.  There is no case where ret can be anything
> other than zero when the assignment is made, making = equivalent to
> += and much more clear.
> 
> Signed-off-by: Alan Ott <alan@signal11.us>
> ---
>  drivers/hid/hidraw.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
> index 468e87b..66fbcba 100644
> --- a/drivers/hid/hidraw.c
> +++ b/drivers/hid/hidraw.c
> @@ -91,7 +91,7 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
>  			ret = -EFAULT;
>  			goto out;
>  		}
> -		ret += len;
> +		ret = len;
>  

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-31 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27  3:25 [PATCH 1/1] hidraw: Replace Confusing += Operator with = Alan Ott
2011-01-31 14:44 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).