From: Julia Lawall <julia.lawall@lip6.fr>
To: Harsha Sharma <harshasharmaiitr@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Merge assignment with return
Date: Thu, 14 Sep 2017 14:29:18 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1709141428080.3185@hadrien> (raw)
In-Reply-To: <1505390645-4461-1-git-send-email-harshasharmaiitr@gmail.com>
On Thu, 14 Sep 2017, Harsha Sharma wrote:
> Merge assignment with return statement to directly return the value.
> Done using following coccinelle semantic patch
>
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
> e;
> -return ret;
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Many of these examples have the property that ret is assigned to 0 but
that value is never used. You could try using Coccinelle to see whether
that occurs in other cases.
julia
>
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index ffbb35a..6a8f805 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -2123,12 +2123,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev,
> struct iw_request_info *info,
> union iwreq_data *wrqu, char *extra)
> {
> - int ret;
> struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
>
> - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
> -
> - return ret;
> + return rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
> }
>
> static int rtw_wx_set_auth(struct net_device *dev,
> @@ -3857,7 +3854,6 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
> {
> /* _irqL irqL; */
> /* struct list_head *phead, *plist; */
> - int ret = 0;
> /* struct sta_info *psta = NULL; */
> struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
> /* struct sta_priv *pstapriv = &padapter->stapriv; */
> @@ -3866,9 +3862,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
>
> flush_all_cam_entry(padapter); /* clear CAM */
>
> - ret = rtw_sta_flush(padapter);
> -
> - return ret;
> + return rtw_sta_flush(padapter);
>
> }
>
> @@ -4266,7 +4260,6 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param,
>
> static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len)
> {
> - int ret = 0;
> struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
> struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>
> @@ -4279,15 +4272,12 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p
> return -EINVAL;
> }
>
> - ret = rtw_acl_remove_sta(padapter, param->sta_addr);
> -
> - return ret;
> + return rtw_acl_remove_sta(padapter, param->sta_addr);
>
> }
>
> static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len)
> {
> - int ret = 0;
> struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
> struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>
> @@ -4300,9 +4290,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para
> return -EINVAL;
> }
>
> - ret = rtw_acl_add_sta(padapter, param->sta_addr);
> -
> - return ret;
> + return rtw_acl_add_sta(padapter, param->sta_addr);
>
> }
>
> --
> 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/1505390645-4461-1-git-send-email-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
prev parent reply other threads:[~2017-09-14 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 12:04 Harsha Sharma
2017-09-14 12:29 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1709141428080.3185@hadrien \
--to=julia.lawall@lip6.fr \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=harshasharmaiitr@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®