All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
@ 2019-03-21 11:12 Sanjana Sanikommu
  2019-03-21 19:01 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-21 11:12 UTC (permalink / raw)
  To: gregkh; +Cc: outreachy-kernel

The last two lines in the function could
be compressed into one. Avoid usage of local variable.
Challenge suggested by Coccinelle using ret.cocci.
The below is the script for ret.cocci:
@@
local idexpression res;
expression e;
@@

-res =
+return
     e;
-return res;

Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 4480deef95a1..70776f8e19a6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps)
 {
 	unsigned int mask = 0;
 
-	mask = (pHT_caps->mcs.rx_mask[0] << 12) |
+	return (pHT_caps->mcs.rx_mask[0] << 12) |
 	       (pHT_caps->mcs.rx_mask[1] << 20);
-
-	return mask;
 }
 
 int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *pHT_caps)
-- 
2.17.1



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

* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
  2019-03-21 11:12 [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle Sanjana Sanikommu
@ 2019-03-21 19:01 ` Greg KH
  2019-03-22 15:27   ` sanjana99reddy99
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-03-21 19:01 UTC (permalink / raw)
  To: Sanjana Sanikommu; +Cc: outreachy-kernel

On Thu, Mar 21, 2019 at 04:42:22PM +0530, Sanjana Sanikommu wrote:
> The last two lines in the function could
> be compressed into one. Avoid usage of local variable.
> Challenge suggested by Coccinelle using ret.cocci.
> The below is the script for ret.cocci:
> @@
> local idexpression res;
> expression e;
> @@
> 
> -res =
> +return
>      e;
> -return res;
> 
> Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> ---
>  drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> index 4480deef95a1..70776f8e19a6 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> @@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps)
>  {
>  	unsigned int mask = 0;
>  
> -	mask = (pHT_caps->mcs.rx_mask[0] << 12) |
> +	return (pHT_caps->mcs.rx_mask[0] << 12) |
>  	       (pHT_caps->mcs.rx_mask[1] << 20);
> -
> -	return mask;
>  }

Did you build this patch?

Just looking at it I can see the compiler warning that it will emit...

Please always test-build your patches, otherwise it just makes people
grumpy :)

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
  2019-03-21 19:01 ` [Outreachy kernel] " Greg KH
@ 2019-03-22 15:27   ` sanjana99reddy99
  2019-03-22 15:43     ` Julia Lawall
  2019-03-22 16:05     ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: sanjana99reddy99 @ 2019-03-22 15:27 UTC (permalink / raw)
  To: outreachy-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1762 bytes --]



On Friday, March 22, 2019 at 12:31:06 AM UTC+5:30, gregkh wrote:
>
> On Thu, Mar 21, 2019 at 04:42:22PM +0530, Sanjana Sanikommu wrote: 
> > The last two lines in the function could 
> > be compressed into one. Avoid usage of local variable. 
> > Challenge suggested by Coccinelle using ret.cocci. 
> > The below is the script for ret.cocci: 
> > @@ 
> > local idexpression res; 
> > expression e; 
> > @@ 
> > 
> > -res = 
> > +return 
> >      e; 
> > -return res; 
> > 
> > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com <javascript:>> 
> > --- 
> >  drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +--- 
> >  1 file changed, 1 insertion(+), 3 deletions(-) 
> > 
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > index 4480deef95a1..70776f8e19a6 100644 
> > --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > @@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct 
> ieee80211_ht_cap *pHT_caps) 
> >  { 
> >          unsigned int mask = 0; 
> >   
> > -        mask = (pHT_caps->mcs.rx_mask[0] << 12) | 
> > +        return (pHT_caps->mcs.rx_mask[0] << 12) | 
> >                 (pHT_caps->mcs.rx_mask[1] << 20); 
> > - 
> > -        return mask; 
> >  } 
>
> Did you build this patch? 
>
> Just looking at it I can see the compiler warning that it will emit... 
>
> Please always test-build your patches, otherwise it just makes people 
> grumpy :) 
>

I apologise for what happened regarding this patch. I submitted this patch 
after
0 errors, 0 warnings, 0 checks i.e after post commit hooks.
I would like to know where I went wrong. I will correct them :)

Sanjana 
   

>
> thanks, 
>
> greg k-h 
>

[-- Attachment #1.2: Type: text/html, Size: 2621 bytes --]

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

* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
  2019-03-22 15:27   ` sanjana99reddy99
@ 2019-03-22 15:43     ` Julia Lawall
  2019-03-22 16:05     ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2019-03-22 15:43 UTC (permalink / raw)
  To: sanjana99reddy99; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 2823 bytes --]



On Fri, 22 Mar 2019, sanjana99reddy99@gmail.com wrote:

>
>
> On Friday, March 22, 2019 at 12:31:06 AM UTC+5:30, gregkh wrote:
>       On Thu, Mar 21, 2019 at 04:42:22PM +0530, Sanjana Sanikommu
>       wrote:
>       > The last two lines in the function could
>       > be compressed into one. Avoid usage of local variable.
>       > Challenge suggested by Coccinelle using ret.cocci.
>       > The below is the script for ret.cocci:
>       > @@
>       > local idexpression res;
>       > expression e;
>       > @@
>       >
>       > -res =
>       > +return
>       > ᅵ ᅵ ᅵe;
>       > -return res;
>       >
>       > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com>
>       > ---
>       > ï¿œdrivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +---
>       > ᅵ1 file changed, 1 insertion(+), 3 deletions(-)
>       >
>       > diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>       b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>       > index 4480deef95a1..70776f8e19a6 100644
>       > --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>       > +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>       > @@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct
>       ieee80211_ht_cap *pHT_caps)
>       > ᅵ{
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵunsigned int mask = 0;
>       > ᅵ
>       > -ᅵᅵᅵᅵᅵᅵᅵᅵmask = (pHT_caps->mcs.rx_mask[0] << 12) |
>       > +ᅵᅵᅵᅵᅵᅵᅵᅵreturn (pHT_caps->mcs.rx_mask[0] << 12) |
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵ ᅵ ᅵ (pHT_caps->mcs.rx_mask[1] << 20);
>       > -
>       > -ᅵᅵᅵᅵᅵᅵᅵᅵreturn mask;
>       > ᅵ}
>
>       Did you build this patch?
>
>       Just looking at it I can see the compiler warning that it will
>       emit...
>
>       Please always test-build your patches, otherwise it just makes
>       people
>       grumpy :)
>
>
> I apologise for what happened regarding this patch. I submitted this patch
> after
> 0 errors, 0 warnings, 0 checks i.e after post commit hooks.
> I would like to know where I went wrong. I will correct them :)

I don't know what is in your post commit hooks.  But the question is about
compilation (make), not checkpatch.

julia

>
> Sanjanaᅵ
> ᅵᅵᅵ
>
>       thanks,
>
>       greg k-h
>
> --
> 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 visithttps://groups.google.com/d/msgid/outreachy-kernel/dcd4eaa9-83e8-448e-ac97-
> 00555572ac62%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

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

* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
  2019-03-22 15:27   ` sanjana99reddy99
  2019-03-22 15:43     ` Julia Lawall
@ 2019-03-22 16:05     ` Greg KH
  2019-03-24  7:15       ` sanjana99reddy99
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-03-22 16:05 UTC (permalink / raw)
  To: sanjana99reddy99; +Cc: outreachy-kernel

On Fri, Mar 22, 2019 at 08:27:09AM -0700, sanjana99reddy99@gmail.com wrote:
> 
> 
> On Friday, March 22, 2019 at 12:31:06 AM UTC+5:30, gregkh wrote:
> >
> > On Thu, Mar 21, 2019 at 04:42:22PM +0530, Sanjana Sanikommu wrote: 
> > > The last two lines in the function could 
> > > be compressed into one. Avoid usage of local variable. 
> > > Challenge suggested by Coccinelle using ret.cocci. 
> > > The below is the script for ret.cocci: 
> > > @@ 
> > > local idexpression res; 
> > > expression e; 
> > > @@ 
> > > 
> > > -res = 
> > > +return 
> > >      e; 
> > > -return res; 
> > > 
> > > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com <javascript:>> 
> > > --- 
> > >  drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +--- 
> > >  1 file changed, 1 insertion(+), 3 deletions(-) 
> > > 
> > > diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > index 4480deef95a1..70776f8e19a6 100644 
> > > --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > @@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct 
> > ieee80211_ht_cap *pHT_caps) 
> > >  { 
> > >          unsigned int mask = 0; 
> > >   
> > > -        mask = (pHT_caps->mcs.rx_mask[0] << 12) | 
> > > +        return (pHT_caps->mcs.rx_mask[0] << 12) | 
> > >                 (pHT_caps->mcs.rx_mask[1] << 20); 
> > > - 
> > > -        return mask; 
> > >  } 
> >
> > Did you build this patch? 
> >
> > Just looking at it I can see the compiler warning that it will emit... 
> >
> > Please always test-build your patches, otherwise it just makes people 
> > grumpy :) 
> >
> 
> I apologise for what happened regarding this patch. I submitted this patch 
> after
> 0 errors, 0 warnings, 0 checks i.e after post commit hooks.
> I would like to know where I went wrong. I will correct them :)

Did you build the code after making the change?  That's the most
important part :)

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle.
  2019-03-22 16:05     ` Greg KH
@ 2019-03-24  7:15       ` sanjana99reddy99
  0 siblings, 0 replies; 6+ messages in thread
From: sanjana99reddy99 @ 2019-03-24  7:15 UTC (permalink / raw)
  To: outreachy-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2277 bytes --]



On Friday, March 22, 2019 at 9:35:36 PM UTC+5:30, Greg Kroah-Hartman wrote:
>
> On Fri, Mar 22, 2019 at 08:27:09AM -0700, sanjana9...@gmail.com 
> <javascript:> wrote: 
> > 
> > 
> > On Friday, March 22, 2019 at 12:31:06 AM UTC+5:30, gregkh wrote: 
> > > 
> > > On Thu, Mar 21, 2019 at 04:42:22PM +0530, Sanjana Sanikommu wrote: 
> > > > The last two lines in the function could 
> > > > be compressed into one. Avoid usage of local variable. 
> > > > Challenge suggested by Coccinelle using ret.cocci. 
> > > > The below is the script for ret.cocci: 
> > > > @@ 
> > > > local idexpression res; 
> > > > expression e; 
> > > > @@ 
> > > > 
> > > > -res = 
> > > > +return 
> > > >      e; 
> > > > -return res; 
> > > > 
> > > > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com 
> <javascript:>> 
> > > > --- 
> > > >  drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +--- 
> > > >  1 file changed, 1 insertion(+), 3 deletions(-) 
> > > > 
> > > > diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > > index 4480deef95a1..70776f8e19a6 100644 
> > > > --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > > +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
> > > > @@ -1182,10 +1182,8 @@ unsigned int update_MSC_rate(struct 
> > > ieee80211_ht_cap *pHT_caps) 
> > > >  { 
> > > >          unsigned int mask = 0; 
> > > >   
> > > > -        mask = (pHT_caps->mcs.rx_mask[0] << 12) | 
> > > > +        return (pHT_caps->mcs.rx_mask[0] << 12) | 
> > > >                 (pHT_caps->mcs.rx_mask[1] << 20); 
> > > > - 
> > > > -        return mask; 
> > > >  } 
> > > 
> > > Did you build this patch? 
> > > 
> > > Just looking at it I can see the compiler warning that it will emit... 
> > > 
> > > Please always test-build your patches, otherwise it just makes people 
> > > grumpy :) 
> > > 
> > 
> > I apologise for what happened regarding this patch. I submitted this 
> patch 
> > after 
> > 0 errors, 0 warnings, 0 checks i.e after post commit hooks. 
> > I would like to know where I went wrong. I will correct them :) 
>
> Did you build the code after making the change?  That's the most 
> important part :) 
>
>    I would resend the patch.
   sanjana

thanks, 
>
> greg k-h 
>

[-- Attachment #1.2: Type: text/html, Size: 3454 bytes --]

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

end of thread, other threads:[~2019-03-24  7:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 11:12 [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle Sanjana Sanikommu
2019-03-21 19:01 ` [Outreachy kernel] " Greg KH
2019-03-22 15:27   ` sanjana99reddy99
2019-03-22 15:43     ` Julia Lawall
2019-03-22 16:05     ` Greg KH
2019-03-24  7:15       ` sanjana99reddy99

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.