* [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements
@ 2016-02-10 8:59 Amitoj Kaur Chawla
2016-02-10 9:13 ` [Outreachy kernel] " Julia Lawall
2016-02-12 3:43 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-10 8:59 UTC (permalink / raw)
To: outreachy-kernel
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 <amitoj1606@gmail.com>
---
drivers/staging/comedi/drivers/comedi_8254.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/staging/comedi/drivers/comedi_8254.c b/drivers/staging/comedi/drivers/comedi_8254.c
index 0d5d56b..1feb2af 100644
--- a/drivers/staging/comedi/drivers/comedi_8254.c
+++ b/drivers/staging/comedi/drivers/comedi_8254.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements
2016-02-10 8:59 [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements Amitoj Kaur Chawla
@ 2016-02-10 9:13 ` Julia Lawall
2016-02-12 3:43 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2016-02-10 9:13 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: outreachy-kernel
On Wed, 10 Feb 2016, Amitoj Kaur Chawla wrote:
> 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
>
> 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 <amitoj1606@gmail.com>
> ---
> drivers/staging/comedi/drivers/comedi_8254.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/comedi_8254.c b/drivers/staging/comedi/drivers/comedi_8254.c
> index 0d5d56b..1feb2af 100644
> --- a/drivers/staging/comedi/drivers/comedi_8254.c
> +++ b/drivers/staging/comedi/drivers/comedi_8254.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements
2016-02-10 8:59 [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements Amitoj Kaur Chawla
2016-02-10 9:13 ` [Outreachy kernel] " Julia Lawall
@ 2016-02-12 3:43 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2016-02-12 3:43 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: outreachy-kernel
On Wed, Feb 10, 2016 at 02:29:09PM +0530, Amitoj Kaur Chawla wrote:
> 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 <amitoj1606@gmail.com>
> ---
> drivers/staging/comedi/drivers/comedi_8254.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/comedi_8254.c b/drivers/staging/comedi/drivers/comedi_8254.c
> index 0d5d56b..1feb2af 100644
> --- a/drivers/staging/comedi/drivers/comedi_8254.c
> +++ b/drivers/staging/comedi/drivers/comedi_8254.c
> @@ -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?
> - if (val > 0xffff)
> - return;
And here? This code was doing something useful, why must it be removed?
confused,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-12 3:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10 8:59 [PATCH 1/6] staging: comedi: drivers: comedi_8254: Remove useless statements Amitoj Kaur Chawla
2016-02-10 9:13 ` [Outreachy kernel] " Julia Lawall
2016-02-12 3:43 ` Greg KH
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.