All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: main: switch multiple assignment for one assignment per line
@ 2020-03-15  4:40 Lourdes Pedrajas
  2020-03-15 16:24 ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Lourdes Pedrajas @ 2020-03-15  4:40 UTC (permalink / raw)
  To: outreachy-kernel, w.d.hubbs, chris, kirk, samuel.thibault, gregkh

One assignment per line is preferred, instead of multiple assignments.
To prevent possible undefined behavior.
Issue found with checkpath.

Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
---
 drivers/staging/speakup/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 488f2539aa9a..d363009863e3 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -2117,7 +2117,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 			spk_keydown = 0;
 			goto out;
 		}
-		value = spk_lastkey = pad_chars[value];
+		spk_lastkey = pad_chars[value];
+		value = pad_chars[value];
 		spk_keydown++;
 		spk_parked &= 0xfe;
 		goto no_map;
-- 
2.17.1



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

* Re: [PATCH] staging: speakup: main: switch multiple assignment for one assignment per line
  2020-03-15  4:40 [PATCH] staging: speakup: main: switch multiple assignment for one assignment per line Lourdes Pedrajas
@ 2020-03-15 16:24 ` Samuel Thibault
  2020-03-15 21:44   ` Lourdes Pedrajas
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2020-03-15 16:24 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel, w.d.hubbs, chris, kirk, gregkh

Hello,

Lourdes Pedrajas, le dim. 15 mars 2020 05:40:51 +0100, a ecrit:
> One assignment per line is preferred, instead of multiple assignments.
> To prevent possible undefined behavior.

Here the behavior is completely defined, but one assignment per line
makes it more readable.

> Issue found with checkpath.
> 
> Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> ---
>  drivers/staging/speakup/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 488f2539aa9a..d363009863e3 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -2117,7 +2117,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
>  			spk_keydown = 0;
>  			goto out;
>  		}
> -		value = spk_lastkey = pad_chars[value];
> +		spk_lastkey = pad_chars[value];
> +		value = pad_chars[value];

Please rather use

		value = pad_chars[value];
		spk_lastkey = value

To make it clear that it's the same value which is used, and to have the
spk_something assignment next to the other spk_something assignments.

>  		spk_keydown++;
>  		spk_parked &= 0xfe;
>  		goto no_map;
> -- 
> 2.17.1
> 


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

* Re: [PATCH] staging: speakup: main: switch multiple assignment for one assignment per line
  2020-03-15 16:24 ` Samuel Thibault
@ 2020-03-15 21:44   ` Lourdes Pedrajas
  0 siblings, 0 replies; 3+ messages in thread
From: Lourdes Pedrajas @ 2020-03-15 21:44 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: outreachy-kernel, w.d.hubbs, chris, kirk, gregkh

On Sun, Mar 15, 2020 at 05:24:46PM +0100, Samuel Thibault wrote:
> Hello,
> 
> Lourdes Pedrajas, le dim. 15 mars 2020 05:40:51 +0100, a ecrit:
> > One assignment per line is preferred, instead of multiple assignments.
> > To prevent possible undefined behavior.
> 
> Here the behavior is completely defined, but one assignment per line
> makes it more readable.
> 
> 
> Please rather use
> 
> 		value = pad_chars[value];
> 		spk_lastkey = value
> 
> To make it clear that it's the same value which is used, and to have the
> spk_something assignment next to the other spk_something assignments.
> 
Thank you for the explanation, I makes sense to me. I will make the
changes,

Lourdes.


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

end of thread, other threads:[~2020-03-15 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-15  4:40 [PATCH] staging: speakup: main: switch multiple assignment for one assignment per line Lourdes Pedrajas
2020-03-15 16:24 ` Samuel Thibault
2020-03-15 21:44   ` Lourdes Pedrajas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.