staging: comedi: drivers: comedi_8254: Merge if conditions
PATCH v2 1/5 staging: comedi: drivers: comedi_8254: Merge if conditions
Merge if conditions with the same statements.
Found using Coccinelle. The semantic patch used to find this is as follows:
//<smpl>
@@
statement S;
expression e,x;
@@
* if(e)
(
{ ... return ...; }
&
S
)
* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>
---
Changes in v2:
-Merged if conditions instead of dropping them.
drivers/staging/comedi/drivers/comedi_8254.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/comedi/drivers/comedi_8254.c +1 -3
@@ -241,9 +241,7 @@ void comedi_8254_write(struct comedi_8254 *i8254, {unsigned int byte; -if (counter >2 ) -return ; -if (val >0xffff ) +if ((counter >2 ) || (val >0xffff ))return ;/* load LSB then MSB */
Signature · 1 line
1.9.1
Quoted 39 lines · Amitoj Kaur Chawla
Merge if conditions with the same statements.
Found using Coccinelle. The semantic patch used to find this is as follows:
//<smpl>
@@
statement S;
expression e,x;
@@* if(e)
(
{ ... return ...; }
&
S
)* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>Signed-off-by Amitoj Kaur Chawla <[email protected]>---
Changes in v2:
-Merged if conditions instead of dropping them.drivers/staging/comedi/drivers/comedi_8254.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/comedi/drivers/comedi_8254.c +0
-0
drivers/staging/comedi/drivers/comedi_8254.c void comedi_8254_write(struct comedi_8254 *i8254, · line 244
Quoted 7 lines
drivers/staging/comedi/drivers/comedi_8254.c +1
-3@@ -241,9 +241,7 @@ void comedi_8254_write(struct comedi_8254 *i8254, {unsigned int byte; -if (counter >2 ) -return ; -if (val >0xffff ) +if ((counter >2 ) || (val >0xffff ))
The parentheses are not needed. || and && have lower precedence than the other operators.
julia
Quoted 13 lines
drivers/staging/comedi/drivers/comedi_8254.c +0
-1return ;/* load LSB then MSB */ --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/20160210101237.GA29034%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.