diff mbox

[OPW,kernel] staging:wlags49_h2: Removed assignments from if statements.

Message ID 1394372428-26185-1-git-send-email-fempsci@gmail.com
State New, archived
Headers show

Commit Message

Chi Pham March 9, 2014, 1:40 p.m. UTC
The following coccinelle script found the match: 

@@
expression E0, E1, E2;
statement S0, S1;
@@
- if ((E1 = E2) != E0) 
+ E1 = E2; 
+ if (E1 != E0) 
S0 else S1

Signed-off-by: Chi Pham <fempsci@gmail.com>
---
 drivers/staging/wlags49_h2/wl_main.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul E. McKenney March 10, 2014, 3:40 p.m. UTC | #1
On Sun, Mar 09, 2014 at 02:40:28PM +0100, Chi Pham wrote:
> The following coccinelle script found the match: 
> 
> @@
> expression E0, E1, E2;
> statement S0, S1;
> @@
> - if ((E1 = E2) != E0) 
> + E1 = E2; 
> + if (E1 != E0) 
> S0 else S1
> 
> Signed-off-by: Chi Pham <fempsci@gmail.com>

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Also suggest following up with a patch to change "len != 0" to just "len".

							Thanx, Paul

> ---
>  drivers/staging/wlags49_h2/wl_main.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c
> index bf6a62e..fc98b6d 100644
> --- a/drivers/staging/wlags49_h2/wl_main.c
> +++ b/drivers/staging/wlags49_h2/wl_main.c
> @@ -1528,7 +1528,8 @@ int wl_put_ltv( struct wl_private *lp )
>  	hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
> 
>  	/* Own Name (Station Nickname) */
> -	if (( len = ( strlen( lp->StationName ) + 1 ) & ~0x01 ) != 0 ) {
> +	len = (strlen(lp->StationName) + 1) & ~0x01;
> +	if (len != 0) {
>  		//DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME                  : %s\n",
>  		//           lp->StationName );
> 
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Greg KH March 18, 2014, 6:15 p.m. UTC | #2
On Sun, Mar 09, 2014 at 02:40:28PM +0100, Chi Pham wrote:
> The following coccinelle script found the match: 
> 
> @@
> expression E0, E1, E2;
> statement S0, S1;
> @@
> - if ((E1 = E2) != E0) 
> + E1 = E2; 
> + if (E1 != E0) 
> S0 else S1
> 
> Signed-off-by: Chi Pham <fempsci@gmail.com>
> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  drivers/staging/wlags49_h2/wl_main.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

This patch is already applied, right?

thanks,

greg k-h
Chi Pham March 18, 2014, 8:25 p.m. UTC | #3
On Tue, Mar 18, 2014 at 7:15 PM, Greg KH <gregkh@linuxfoundation.org> wrote:

> On Sun, Mar 09, 2014 at 02:40:28PM +0100, Chi Pham wrote:
> > The following coccinelle script found the match:
> >
> > @@
> > expression E0, E1, E2;
> > statement S0, S1;
> > @@
> > - if ((E1 = E2) != E0)
> > + E1 = E2;
> > + if (E1 != E0)
> > S0 else S1
> >
> > Signed-off-by: Chi Pham <fempsci@gmail.com>
> > Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> >  drivers/staging/wlags49_h2/wl_main.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
>
> This patch is already applied, right?
>
> thanks,
>
> greg k-h
>

Yep, I believe I don't have any pending patches left :)
diff mbox

Patch

diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c
index bf6a62e..fc98b6d 100644
--- a/drivers/staging/wlags49_h2/wl_main.c
+++ b/drivers/staging/wlags49_h2/wl_main.c
@@ -1528,7 +1528,8 @@  int wl_put_ltv( struct wl_private *lp )
 	hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
 
 	/* Own Name (Station Nickname) */
-	if (( len = ( strlen( lp->StationName ) + 1 ) & ~0x01 ) != 0 ) {
+	len = (strlen(lp->StationName) + 1) & ~0x01;
+	if (len != 0) {
 		//DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME                  : %s\n",
 		//           lp->StationName );