staging: comedi: drivers: comedi_8254: Remove useless statements
PATCH 1/6 staging: comedi: drivers: comedi_8254: Remove useless statements
Drop if conditions that have an unrequired return in a void function.
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>
--- drivers/staging/comedi/drivers/comedi_8254.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/comedi/drivers/comedi_8254.c +0 -5
@@ -241,11 +241,6 @@ void comedi_8254_write(struct comedi_8254 *i8254, {unsigned int byte; -if (counter >2 ) -return ; -if (val >0xffff ) -return ; -/* load LSB then MSB */ byte = val &0xff ;__i8254_write (i8254, byte, counter);
Signature · 1 line
1.9.1
Quoted 1 line · Amitoj Kaur Chawla
Drop if conditions that have an unrequired return in a void function.
Again, the return is needed, because it is not at the end of the function.
julia
Quoted 56 lines
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]>--- drivers/staging/comedi/drivers/comedi_8254.c | 5 ----- 1 file changed, 5 deletions(-)drivers/staging/comedi/drivers/comedi_8254.c +0
-6@@ -241,11 +241,6 @@ void comedi_8254_write(struct comedi_8254 *i8254, {unsigned int byte; -if (counter >2 ) -return ; -if (val >0xffff ) -return ; -/* load LSB then MSB */ byte = val &0xff ;__i8254_write (i8254, byte, counter); --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/20160210085909.GA14587%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.
Greg KH
maintainerQuoted 36 lines · Amitoj Kaur Chawla
Drop if conditions that have an unrequired return in a void function.
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]>--- drivers/staging/comedi/drivers/comedi_8254.c | 5 ----- 1 file changed, 5 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 245
Quoted 5 lines
drivers/staging/comedi/drivers/comedi_8254.c +0
-2@@ -241,11 +241,6 @@ void comedi_8254_write(struct comedi_8254 *i8254, {unsigned int byte; -if (counter >2 ) -return ;
I don't understand, why did you change the logic of the code here?
drivers/staging/comedi/drivers/comedi_8254.c void comedi_8254_write(struct comedi_8254 *i8254, · line 247
Quoted 2 lines
drivers/staging/comedi/drivers/comedi_8254.c +0
-2-if (val >0xffff ) -return ;
And here? This code was doing something useful, why must it be removed?
confused,
greg k-h