X-GM-THRID: 6670800416333103104 Date: Fri, 22 Mar 2019 08:27:09 -0700 (PDT) From: sanjana99reddy99@gmail.com To: outreachy-kernel Message-Id: In-Reply-To: <20190321190102.GA30770@kroah.com> References: <20190321111222.11964-1-sanjana99reddy99@gmail.com> <20190321190102.GA30770@kroah.com> Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_wlan_util.c: Modify return type suggested by Coccinelle. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_759_1784165648.1553268429913" X-Google-Token: EM390-QFBwl9XdYKLBs0 X-Google-IP: 219.91.254.53 ------=_Part_759_1784165648.1553268429913 Content-Type: multipart/alternative; boundary="----=_Part_760_1172641794.1553268429913" ------=_Part_760_1172641794.1553268429913 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > > > --- > > 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 > ------=_Part_760_1172641794.1553268429913 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


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;
> @@
>=20
> -res =3D
> +return
> =C2=A0 =C2=A0 =C2=A0e;
> -return res;
>=20
> Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com>
> ---
> =C2=A0drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 +---
> =C2=A01 file changed, 1 insertion(+), 3 deletions(-)
>=20
> 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 ieee802= 11_ht_cap *pHT_caps)
> =C2=A0{
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned int= mask =3D 0;
> =C2=A0
> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mask =3D (pHT_cap= s->mcs.rx_mask[0] << 12) |
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return (pHT_caps-= >mcs.rx_mask[0] << 12) |
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (pHT_caps->mcs.rx_mask[1] << 20);
> -
> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return mask;
> =C2=A0}

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 regardin= g 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=C2=A0=
=C2=A0=C2=A0=C2=A0

thanks,

greg k-h
------=_Part_760_1172641794.1553268429913-- ------=_Part_759_1784165648.1553268429913--