All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Staging: irda: Don't use assignment inside if statement
@ 2017-09-15 19:44 Srishti Sharma
  2017-09-15 20:00 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Srishti Sharma @ 2017-09-15 19:44 UTC (permalink / raw
  To: samuel
  Cc: gregkh, netdev, devel, linux-kernel, outreachy-kernel,
	Srishti Sharma

Write assignment statement outside the if statement. Done using
the following semantic patch by coccinelle.

@@
identifier E;
expression F;
statement S;
@@

-if((E = F))
+E = F;
+if(E)
  S

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
Changes in v2:
 -Semicolon was missing in one of the statements of the 
  semantic patch
 
 drivers/staging/irda/drivers/irda-usb.c | 4 ++--
 drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
 drivers/staging/irda/net/irqueue.c      | 3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
index 723e49b..82bfc05 100644
--- a/drivers/staging/irda/drivers/irda-usb.c
+++ b/drivers/staging/irda/drivers/irda-usb.c
@@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
 	urb->transfer_flags = 0;
 
 	/* Irq disabled -> GFP_ATOMIC */
-	if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
+	ret = usb_submit_urb(urb, GFP_ATOMIC);
+	if (ret)
 		net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
-	}
 }
 
 /*------------------------------------------------------------------*/
diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
index c3f0b25..2b674d5 100644
--- a/drivers/staging/irda/drivers/mcs7780.c
+++ b/drivers/staging/irda/drivers/mcs7780.c
@@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
 	if (mcs->new_speed <= 115200) {
 		rval &= ~MCS_FIR;
 
-		if ((rst = (mcs->speed > 115200)))
+		rst = (mcs->speed > 115200);
+		if (rst)
 			mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
 
 	} else if (mcs->new_speed <= 1152000) {
 		rval &= ~MCS_FIR;
 
-		if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
+		rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
+		if (rst)
 			mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
 
 	} else {
 		rval |= MCS_FIR;
 
-		if ((rst = (mcs->speed != 4000000)))
+		rst = (mcs->speed != 4000000);
+		if (rst)
 			mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
 
 	}
diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
index 160dc89..5aab072 100644
--- a/drivers/staging/irda/net/irqueue.c
+++ b/drivers/staging/irda/net/irqueue.c
@@ -217,7 +217,8 @@ static __u32 hash( const char* name)
 
 	while(*name) {
 		h = (h<<4) + *name++;
-		if ((g = (h & 0xf0000000)))
+		g = (h & 0xf0000000);
+		if (g)
 			h ^=g>>24;
 		h &=~g;
 	}
-- 
2.7.4

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

* Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
  2017-09-15 19:44 [PATCH v2] Staging: irda: Don't use assignment inside if statement Srishti Sharma
@ 2017-09-15 20:00 ` Julia Lawall
  2017-09-15 21:07   ` Srishti Sharma
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2017-09-15 20:00 UTC (permalink / raw
  To: Srishti Sharma
  Cc: samuel, gregkh, netdev, devel, linux-kernel, outreachy-kernel



On Sat, 16 Sep 2017, Srishti Sharma wrote:

> Write assignment statement outside the if statement. Done using
> the following semantic patch by coccinelle.
>
> @@
> identifier E;
> expression F;
> statement S;
> @@
>
> -if((E = F))
> +E = F;
> +if(E)
>   S
>
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>


> ---
> Changes in v2:
>  -Semicolon was missing in one of the statements of the
>   semantic patch
>
>  drivers/staging/irda/drivers/irda-usb.c | 4 ++--
>  drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
>  drivers/staging/irda/net/irqueue.c      | 3 ++-
>  3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
> index 723e49b..82bfc05 100644
> --- a/drivers/staging/irda/drivers/irda-usb.c
> +++ b/drivers/staging/irda/drivers/irda-usb.c
> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
>  	urb->transfer_flags = 0;
>
>  	/* Irq disabled -> GFP_ATOMIC */
> -	if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
> +	ret = usb_submit_urb(urb, GFP_ATOMIC);
> +	if (ret)
>  		net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
> -	}
>  }
>
>  /*------------------------------------------------------------------*/
> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
> index c3f0b25..2b674d5 100644
> --- a/drivers/staging/irda/drivers/mcs7780.c
> +++ b/drivers/staging/irda/drivers/mcs7780.c
> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
>  	if (mcs->new_speed <= 115200) {
>  		rval &= ~MCS_FIR;
>
> -		if ((rst = (mcs->speed > 115200)))
> +		rst = (mcs->speed > 115200);
> +		if (rst)
>  			mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
>
>  	} else if (mcs->new_speed <= 1152000) {
>  		rval &= ~MCS_FIR;
>
> -		if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
> +		rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
> +		if (rst)
>  			mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>
>  	} else {
>  		rval |= MCS_FIR;
>
> -		if ((rst = (mcs->speed != 4000000)))
> +		rst = (mcs->speed != 4000000);
> +		if (rst)
>  			mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>
>  	}
> diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
> index 160dc89..5aab072 100644
> --- a/drivers/staging/irda/net/irqueue.c
> +++ b/drivers/staging/irda/net/irqueue.c
> @@ -217,7 +217,8 @@ static __u32 hash( const char* name)
>
>  	while(*name) {
>  		h = (h<<4) + *name++;
> -		if ((g = (h & 0xf0000000)))
> +		g = (h & 0xf0000000);
> +		if (g)
>  			h ^=g>>24;
>  		h &=~g;
>  	}
> --
> 2.7.4
>
> --
> 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/1505504680-22167-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

* Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
  2017-09-15 20:00 ` [Outreachy kernel] " Julia Lawall
@ 2017-09-15 21:07   ` Srishti Sharma
  2017-09-15 21:09     ` Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Srishti Sharma @ 2017-09-15 21:07 UTC (permalink / raw
  To: Julia Lawall
  Cc: samuel, Greg KH, netdev, devel, Linux kernel mailing list,
	outreachy-kernel

On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sat, 16 Sep 2017, Srishti Sharma wrote:
>
>> Write assignment statement outside the if statement. Done using
>> the following semantic patch by coccinelle.
>>
>> @@
>> identifier E;
>> expression F;
>> statement S;
>> @@
>>
>> -if((E = F))
>> +E = F;
>> +if(E)
>>   S
>>
>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>

Have sent a patchset for this instead .

Regards,
Srishti
>
>> ---
>> Changes in v2:
>>  -Semicolon was missing in one of the statements of the
>>   semantic patch
>>
>>  drivers/staging/irda/drivers/irda-usb.c | 4 ++--
>>  drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
>>  drivers/staging/irda/net/irqueue.c      | 3 ++-
>>  3 files changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
>> index 723e49b..82bfc05 100644
>> --- a/drivers/staging/irda/drivers/irda-usb.c
>> +++ b/drivers/staging/irda/drivers/irda-usb.c
>> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
>>       urb->transfer_flags = 0;
>>
>>       /* Irq disabled -> GFP_ATOMIC */
>> -     if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
>> +     ret = usb_submit_urb(urb, GFP_ATOMIC);
>> +     if (ret)
>>               net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
>> -     }
>>  }
>>
>>  /*------------------------------------------------------------------*/
>> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
>> index c3f0b25..2b674d5 100644
>> --- a/drivers/staging/irda/drivers/mcs7780.c
>> +++ b/drivers/staging/irda/drivers/mcs7780.c
>> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
>>       if (mcs->new_speed <= 115200) {
>>               rval &= ~MCS_FIR;
>>
>> -             if ((rst = (mcs->speed > 115200)))
>> +             rst = (mcs->speed > 115200);
>> +             if (rst)
>>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
>>
>>       } else if (mcs->new_speed <= 1152000) {
>>               rval &= ~MCS_FIR;
>>
>> -             if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
>> +             rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
>> +             if (rst)
>>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>>
>>       } else {
>>               rval |= MCS_FIR;
>>
>> -             if ((rst = (mcs->speed != 4000000)))
>> +             rst = (mcs->speed != 4000000);
>> +             if (rst)
>>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>>
>>       }
>> diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
>> index 160dc89..5aab072 100644
>> --- a/drivers/staging/irda/net/irqueue.c
>> +++ b/drivers/staging/irda/net/irqueue.c
>> @@ -217,7 +217,8 @@ static __u32 hash( const char* name)
>>
>>       while(*name) {
>>               h = (h<<4) + *name++;
>> -             if ((g = (h & 0xf0000000)))
>> +             g = (h & 0xf0000000);
>> +             if (g)
>>                       h ^=g>>24;
>>               h &=~g;
>>       }
>> --
>> 2.7.4
>>
>> --
>> 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/1505504680-22167-1-git-send-email-srishtishar%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>

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

* Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
  2017-09-15 21:07   ` Srishti Sharma
@ 2017-09-15 21:09     ` Julia Lawall
  2017-09-15 21:14         ` Srishti Sharma
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2017-09-15 21:09 UTC (permalink / raw
  To: Srishti Sharma
  Cc: samuel, Greg KH, netdev, devel, Linux kernel mailing list,
	outreachy-kernel



On Sat, 16 Sep 2017, Srishti Sharma wrote:

> On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> >
> > On Sat, 16 Sep 2017, Srishti Sharma wrote:
> >
> >> Write assignment statement outside the if statement. Done using
> >> the following semantic patch by coccinelle.
> >>
> >> @@
> >> identifier E;
> >> expression F;
> >> statement S;
> >> @@
> >>
> >> -if((E = F))
> >> +E = F;
> >> +if(E)
> >>   S
> >>
> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> >
> > Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>
> Have sent a patchset for this instead .

Thanks.  Actually, you should have copied the ack.

julia

>
> Regards,
> Srishti
> >
> >> ---
> >> Changes in v2:
> >>  -Semicolon was missing in one of the statements of the
> >>   semantic patch
> >>
> >>  drivers/staging/irda/drivers/irda-usb.c | 4 ++--
> >>  drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
> >>  drivers/staging/irda/net/irqueue.c      | 3 ++-
> >>  3 files changed, 10 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
> >> index 723e49b..82bfc05 100644
> >> --- a/drivers/staging/irda/drivers/irda-usb.c
> >> +++ b/drivers/staging/irda/drivers/irda-usb.c
> >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
> >>       urb->transfer_flags = 0;
> >>
> >>       /* Irq disabled -> GFP_ATOMIC */
> >> -     if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
> >> +     ret = usb_submit_urb(urb, GFP_ATOMIC);
> >> +     if (ret)
> >>               net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
> >> -     }
> >>  }
> >>
> >>  /*------------------------------------------------------------------*/
> >> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
> >> index c3f0b25..2b674d5 100644
> >> --- a/drivers/staging/irda/drivers/mcs7780.c
> >> +++ b/drivers/staging/irda/drivers/mcs7780.c
> >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
> >>       if (mcs->new_speed <= 115200) {
> >>               rval &= ~MCS_FIR;
> >>
> >> -             if ((rst = (mcs->speed > 115200)))
> >> +             rst = (mcs->speed > 115200);
> >> +             if (rst)
> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
> >>
> >>       } else if (mcs->new_speed <= 1152000) {
> >>               rval &= ~MCS_FIR;
> >>
> >> -             if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
> >> +             rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
> >> +             if (rst)
> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
> >>
> >>       } else {
> >>               rval |= MCS_FIR;
> >>
> >> -             if ((rst = (mcs->speed != 4000000)))
> >> +             rst = (mcs->speed != 4000000);
> >> +             if (rst)
> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
> >>
> >>       }
> >> diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
> >> index 160dc89..5aab072 100644
> >> --- a/drivers/staging/irda/net/irqueue.c
> >> +++ b/drivers/staging/irda/net/irqueue.c
> >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name)
> >>
> >>       while(*name) {
> >>               h = (h<<4) + *name++;
> >> -             if ((g = (h & 0xf0000000)))
> >> +             g = (h & 0xf0000000);
> >> +             if (g)
> >>                       h ^=g>>24;
> >>               h &=~g;
> >>       }
> >> --
> >> 2.7.4
> >>
> >> --
> >> 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/1505504680-22167-1-git-send-email-srishtishar%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 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/CAB3L5oxr5K5aMo06ROCVV9ejY6a_g1%2BuUkjU%3DZ5bKTJtzUs7sA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

* Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
  2017-09-15 21:09     ` Julia Lawall
@ 2017-09-15 21:14         ` Srishti Sharma
  0 siblings, 0 replies; 6+ messages in thread
From: Srishti Sharma @ 2017-09-15 21:14 UTC (permalink / raw
  To: Julia Lawall
  Cc: samuel, Greg KH, netdev, devel, Linux kernel mailing list,
	outreachy-kernel

On Sat, Sep 16, 2017 at 2:39 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sat, 16 Sep 2017, Srishti Sharma wrote:
>
>> On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> >
>> >
>> > On Sat, 16 Sep 2017, Srishti Sharma wrote:
>> >
>> >> Write assignment statement outside the if statement. Done using
>> >> the following semantic patch by coccinelle.
>> >>
>> >> @@
>> >> identifier E;
>> >> expression F;
>> >> statement S;
>> >> @@
>> >>
>> >> -if((E = F))
>> >> +E = F;
>> >> +if(E)
>> >>   S
>> >>
>> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> >
>> > Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>>
>> Have sent a patchset for this instead .
>
> Thanks.  Actually, you should have copied the ack.

Oh.. Sorry didn't realise I could do that :)

Regards,
Srishti

>
> julia
>
>>
>> Regards,
>> Srishti
>> >
>> >> ---
>> >> Changes in v2:
>> >>  -Semicolon was missing in one of the statements of the
>> >>   semantic patch
>> >>
>> >>  drivers/staging/irda/drivers/irda-usb.c | 4 ++--
>> >>  drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
>> >>  drivers/staging/irda/net/irqueue.c      | 3 ++-
>> >>  3 files changed, 10 insertions(+), 6 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
>> >> index 723e49b..82bfc05 100644
>> >> --- a/drivers/staging/irda/drivers/irda-usb.c
>> >> +++ b/drivers/staging/irda/drivers/irda-usb.c
>> >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
>> >>       urb->transfer_flags = 0;
>> >>
>> >>       /* Irq disabled -> GFP_ATOMIC */
>> >> -     if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
>> >> +     ret = usb_submit_urb(urb, GFP_ATOMIC);
>> >> +     if (ret)
>> >>               net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
>> >> -     }
>> >>  }
>> >>
>> >>  /*------------------------------------------------------------------*/
>> >> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
>> >> index c3f0b25..2b674d5 100644
>> >> --- a/drivers/staging/irda/drivers/mcs7780.c
>> >> +++ b/drivers/staging/irda/drivers/mcs7780.c
>> >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
>> >>       if (mcs->new_speed <= 115200) {
>> >>               rval &= ~MCS_FIR;
>> >>
>> >> -             if ((rst = (mcs->speed > 115200)))
>> >> +             rst = (mcs->speed > 115200);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
>> >>
>> >>       } else if (mcs->new_speed <= 1152000) {
>> >>               rval &= ~MCS_FIR;
>> >>
>> >> -             if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
>> >> +             rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>> >>
>> >>       } else {
>> >>               rval |= MCS_FIR;
>> >>
>> >> -             if ((rst = (mcs->speed != 4000000)))
>> >> +             rst = (mcs->speed != 4000000);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>> >>
>> >>       }
>> >> diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
>> >> index 160dc89..5aab072 100644
>> >> --- a/drivers/staging/irda/net/irqueue.c
>> >> +++ b/drivers/staging/irda/net/irqueue.c
>> >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name)
>> >>
>> >>       while(*name) {
>> >>               h = (h<<4) + *name++;
>> >> -             if ((g = (h & 0xf0000000)))
>> >> +             g = (h & 0xf0000000);
>> >> +             if (g)
>> >>                       h ^=g>>24;
>> >>               h &=~g;
>> >>       }
>> >> --
>> >> 2.7.4
>> >>
>> >> --
>> >> 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/1505504680-22167-1-git-send-email-srishtishar%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 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/CAB3L5oxr5K5aMo06ROCVV9ejY6a_g1%2BuUkjU%3DZ5bKTJtzUs7sA%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>

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

* Re: [Outreachy kernel] [PATCH v2] Staging: irda: Don't use assignment inside if statement
@ 2017-09-15 21:14         ` Srishti Sharma
  0 siblings, 0 replies; 6+ messages in thread
From: Srishti Sharma @ 2017-09-15 21:14 UTC (permalink / raw
  To: Julia Lawall
  Cc: devel, samuel, Greg KH, Linux kernel mailing list,
	outreachy-kernel, netdev

On Sat, Sep 16, 2017 at 2:39 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sat, 16 Sep 2017, Srishti Sharma wrote:
>
>> On Sat, Sep 16, 2017 at 1:30 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> >
>> >
>> > On Sat, 16 Sep 2017, Srishti Sharma wrote:
>> >
>> >> Write assignment statement outside the if statement. Done using
>> >> the following semantic patch by coccinelle.
>> >>
>> >> @@
>> >> identifier E;
>> >> expression F;
>> >> statement S;
>> >> @@
>> >>
>> >> -if((E = F))
>> >> +E = F;
>> >> +if(E)
>> >>   S
>> >>
>> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> >
>> > Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>>
>> Have sent a patchset for this instead .
>
> Thanks.  Actually, you should have copied the ack.

Oh.. Sorry didn't realise I could do that :)

Regards,
Srishti

>
> julia
>
>>
>> Regards,
>> Srishti
>> >
>> >> ---
>> >> Changes in v2:
>> >>  -Semicolon was missing in one of the statements of the
>> >>   semantic patch
>> >>
>> >>  drivers/staging/irda/drivers/irda-usb.c | 4 ++--
>> >>  drivers/staging/irda/drivers/mcs7780.c  | 9 ++++++---
>> >>  drivers/staging/irda/net/irqueue.c      | 3 ++-
>> >>  3 files changed, 10 insertions(+), 6 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c
>> >> index 723e49b..82bfc05 100644
>> >> --- a/drivers/staging/irda/drivers/irda-usb.c
>> >> +++ b/drivers/staging/irda/drivers/irda-usb.c
>> >> @@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
>> >>       urb->transfer_flags = 0;
>> >>
>> >>       /* Irq disabled -> GFP_ATOMIC */
>> >> -     if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
>> >> +     ret = usb_submit_urb(urb, GFP_ATOMIC);
>> >> +     if (ret)
>> >>               net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
>> >> -     }
>> >>  }
>> >>
>> >>  /*------------------------------------------------------------------*/
>> >> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
>> >> index c3f0b25..2b674d5 100644
>> >> --- a/drivers/staging/irda/drivers/mcs7780.c
>> >> +++ b/drivers/staging/irda/drivers/mcs7780.c
>> >> @@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs)
>> >>       if (mcs->new_speed <= 115200) {
>> >>               rval &= ~MCS_FIR;
>> >>
>> >> -             if ((rst = (mcs->speed > 115200)))
>> >> +             rst = (mcs->speed > 115200);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
>> >>
>> >>       } else if (mcs->new_speed <= 1152000) {
>> >>               rval &= ~MCS_FIR;
>> >>
>> >> -             if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
>> >> +             rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>> >>
>> >>       } else {
>> >>               rval |= MCS_FIR;
>> >>
>> >> -             if ((rst = (mcs->speed != 4000000)))
>> >> +             rst = (mcs->speed != 4000000);
>> >> +             if (rst)
>> >>                       mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>> >>
>> >>       }
>> >> diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
>> >> index 160dc89..5aab072 100644
>> >> --- a/drivers/staging/irda/net/irqueue.c
>> >> +++ b/drivers/staging/irda/net/irqueue.c
>> >> @@ -217,7 +217,8 @@ static __u32 hash( const char* name)
>> >>
>> >>       while(*name) {
>> >>               h = (h<<4) + *name++;
>> >> -             if ((g = (h & 0xf0000000)))
>> >> +             g = (h & 0xf0000000);
>> >> +             if (g)
>> >>                       h ^=g>>24;
>> >>               h &=~g;
>> >>       }
>> >> --
>> >> 2.7.4
>> >>
>> >> --
>> >> 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/1505504680-22167-1-git-send-email-srishtishar%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 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/CAB3L5oxr5K5aMo06ROCVV9ejY6a_g1%2BuUkjU%3DZ5bKTJtzUs7sA%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>

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

end of thread, other threads:[~2017-09-15 21:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-15 19:44 [PATCH v2] Staging: irda: Don't use assignment inside if statement Srishti Sharma
2017-09-15 20:00 ` [Outreachy kernel] " Julia Lawall
2017-09-15 21:07   ` Srishti Sharma
2017-09-15 21:09     ` Julia Lawall
2017-09-15 21:14       ` Srishti Sharma
2017-09-15 21:14         ` Srishti Sharma

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.