[PATCH] staging: rtl8723au : remove goto & return error directly

Jes Sorensen Jes.Sorensen at redhat.com
Thu May 7 12:03:06 UTC 2015


"Gujulan Elango, Hari Prasath (H.)" <hgujulan at visteon.com> writes:
> Remove the goto and return error directly thereby removing a variable
>
> Signed-off-by: Hari Prasath Gujulan Elango <hgujulan at visteon.com>
> ---
>  drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

NACK!

The goto is cleaner and more consistent, rather than hiding a return in
the middle of the code.

Jes

>
> diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> index b139ed4..a979048 100644
> --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> @@ -1209,7 +1209,6 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
>  	struct rtw_adapter *padapter = wiphy_to_adapter(wiphy);
>  	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
>  	struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy);
> -	int ret = 0;
>  
>  	DBG_8723A("%s(%s): call netdev_open23a\n", __func__, ndev->name);
>  
> @@ -1238,14 +1237,12 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
>  
>  	if (cfg80211_infrastructure_mode(padapter, type) != _SUCCESS) {
>  		rtw_wdev->iftype = old_type;
> -		ret = -EPERM;
> -		goto exit;
> +		return -EPERM;
>  	}
>  
>  	rtw_setopmode_cmd23a(padapter, type);
>  
> -exit:
> -	return ret;
> +	return 0;
>  }
>  
>  void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,


More information about the devel mailing list