Remove multiple assignments
Subsystems (2)
cover Remove multiple assignments
This patchset removes multiple assignment by factorizing them. Made a coccinelle script to match cases:
@@
identifier a,b;
constant c;
@@
-a=b=c;
+a=c;
+b=c;
Bhumika Goyal (2):
Staging: wlan-ng: Remove multiple assignments
Staging: media: Remove multiple assignments
drivers/staging/media/davinci_vpfe/dm365_isif.c | 3 ++- drivers/staging/wlan-ng/p80211wep.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 Staging: wlan-ng: Remove multiple assignments
Remove multiple assignments by factorizing them.
Made a coccinelle script to match cases:
@@
identifier a,b;
constant c;
@@
-a=b=c;
+a=c;
+b=c;
--- drivers/staging/wlan-ng/p80211wep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/wlan-ng/p80211wep.c +4 -2
@@ -188,7 +188,8 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,/* Apply the RC4 to the data, update the CRC32 */ crc = ~0 ; - i = j =0 ; + i =0 ; + j =0 ;for (k =0 ; k < len; k++) { i = (i +1 ) &0xff ; j = (j + s[i]) &0xff ;
@@ -260,7 +261,8 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum,/* Update CRC32 then apply RC4 to the data */ crc = ~0 ; - i = j =0 ; + i =0 ; + j =0 ;for (k =0 ; k < len; k++) { crc = wep_crc32_table[(crc ^ buf[k]) &0xff ] ^ (crc >>8 ); i = (i +1 ) &0xff ;
Signature · 1 line
1.9.1
PATCH 2/2 Staging: media: Remove multiple assignments
In reply to Bhumika GoyalRemove multiple assignments by factorizing them.
Made a coccinelle script to match cases:
@@
identifier a,b;
constant c;
@@
-a=b=c;
+a=c;
+b=c;
--- drivers/staging/media/davinci_vpfe/dm365_isif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/dm365_isif.c +2 -1
@@ -1239,7 +1239,8 @@ static int isif_config_ycbcr(struct v4l2_subdev *sd, int mode)* a lot of registers that we didn't touch */ /* start with all bits zero */ - ccdcfg = modeset =0 ; + ccdcfg =0 ; + modeset =0 ; pix_fmt =isif_get_pix_fmt (format->code);if (pix_fmt <0 ) {pr_debug ("Invalid pix_fmt(input mode)\n" );
Signature · 1 line
1.9.1
Review
Quoted 9 lines · Bhumika Goyal
This patchset removes multiple assignment by factorizing them. Made a coccinelle script to match cases:
@@
identifier a,b;
constant c;
@@(quoted diff) +2
-1-a=b=c; +a=c; +b=c;
The double assgnments are actually a bit annoying from a Coccinelle point of view. But probably from a human developer point of view, the original code is better, because it is more concise, and anyway the assignments are completely trivial.
julia
Quoted 19 lines
Bhumika Goyal (2):
Staging: wlan-ng: Remove multiple assignments
Staging: media: Remove multiple assignmentsdrivers/staging/media/davinci_vpfe/dm365_isif.c | 3 ++- drivers/staging/wlan-ng/p80211wep.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)Signature · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1455343091.git.bhumirks%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Quoted 19 lines · Julia Lawall
Review
Quoted 9 lines · Bhumika Goyal
This patchset removes multiple assignment by factorizing them. Made a coccinelle script to match cases:
@@
identifier a,b;
constant c;
@@(quoted diff) +2
-1-a=b=c; +a=c; +b=c;The double assgnments are actually a bit annoying from a Coccinelle point of view. But probably from a human developer point of view, the original code is better, because it is more concise, and anyway the assignments are completely trivial.
Ok will keep that in mind. But then checkpatch warning for double
assignments is false positive ?
Thanks
Bhumika
Quoted 27 lines
julia
Quoted 14 lines
Bhumika Goyal (2):
Staging: wlan-ng: Remove multiple assignments
Staging: media: Remove multiple assignmentsdrivers/staging/media/davinci_vpfe/dm365_isif.c | 3 ++- drivers/staging/wlan-ng/p80211wep.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)Signature · 4 lines
1.9.1 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/cover.1455343091.git.bhumirks%40gmail.com.
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 2 lines
Ok will keep that in mind. But then checkpatch warning for double assignments is false positive ?
Ah ok, I didn't realize that checkpatch complains about this. I guess the change is fine in that case.
julia
Quoted 40 lines
Thanks
Bhumika
julia>
> Bhumika Goyal (2):
> Staging: wlan-ng: Remove multiple assignments
> Staging: media: Remove multiple assignments
>
> drivers/staging/media/davinci_vpfe/dm365_isif.c | 3 ++-
> drivers/staging/wlan-ng/p80211wep.c | 6 ++++--
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the
Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected].
> To post to this group, send email to
[email protected].
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/cover.1455343091.git.bhu mirks%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/8615600f-b029-4b7c-bcdb- aee18a663cc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.