staging: rtl8723au : remove goto & return error directly
PATCH 1/1 staging: rtl8723au : remove goto & return error directly
Remove the goto and return error directly thereby removing a variable
--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +2 -5
@@ -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,
Signature · 1 line
1.9.1
Jes Sorensen
NAKQuoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- 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
Quoted 30 lines
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +2
-5@@ -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,
Quoted 9 lines · Jes Sorensen
Quoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
Quoted 3 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
regards,
dan carpenter
Quoted 14 lines · Dan Carpenter
Quoted 9 lines · Jes Sorensen
Quoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
Quoted 1 line
Quoted 9 lines
Quoted 2 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
regards,
dan carpenter
I sent this patch because goto & return was mixed up in this function. There was a return as well as goto used. And i guess goto is not encouraged anywhere. In this case especially,I couldn't see any significant cleanup being done in the goto label.
Quoted 21 lines · Hari Prasath (H.)
Quoted 20 lines · Dan Carpenter
Quoted 9 lines · Jes Sorensen
Quoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
Quoted 3 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
Quoted 8 lines
Quoted 3 lines
regards,
dan carpenterI sent this patch because goto & return was mixed up in this function. There was a return as well as goto used. And i guess goto is not encouraged anywhere. In this case especially,I couldn't see any significant cleanup being done in the goto label.
I will accept a patch to remove the returns in the middle of the function, if you wish to submit that.
A return at the very beginning of a function is OK, but in the middle of a larger function they make it harder to catch when code exists.
Jes
Quoted 31 lines · Jes Sorensen
Quoted 21 lines · Hari Prasath (H.)
Quoted 20 lines · Dan Carpenter
Quoted 9 lines · Jes Sorensen
Quoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
Quoted 3 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
Quoted 8 lines
Quoted 3 lines
regards,
dan carpenterI sent this patch because goto & return was mixed up in this function. There was a return as well as goto used. And i guess goto is not encouraged anywhere. In this case especially,I couldn't see any significant cleanup being done in the goto label.
Quoted 7 lines
I will accept a patch to remove the returns in the middle of the function, if you wish to submit that.
A return at the very beginning of a function is OK, but in the middle of a larger function they make it harder to catch when code exists.
Jes
Is this accepted as it is or should I send v2 with the goto retained but the return in the middle of the function also converted to goto for consistency.I agree that goto's are used at many places in the kernel but this is really a small function where it doesn't seem to help much.Also there is no signficant cleanup being done in the definition of the label.
regards
Hari
Quoted 38 lines · Hari Prasath (H.)
Quoted 37 lines · Jes Sorensen
Quoted 21 lines · Hari Prasath (H.)
Quoted 20 lines · Dan Carpenter
Quoted 9 lines · Jes Sorensen
Quoted 6 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
Quoted 3 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
Quoted 8 lines
Quoted 3 lines
regards,
dan carpenterI sent this patch because goto & return was mixed up in this function. There was a return as well as goto used. And i guess goto is not encouraged anywhere. In this case especially,I couldn't see any significant cleanup being done in the goto label.
I will accept a patch to remove the returns in the middle of the function, if you wish to submit that.
A return at the very beginning of a function is OK, but in the middle of a larger function they make it harder to catch when code exists.
Quoted 8 lines
Quoted 1 line
Jes
Is this accepted as it is or should I send v2 with the goto retained but the return in the middle of the function also converted to goto for consistency.I agree that goto's are used at many places in the kernel but this is really a small function where it doesn't seem to help much.Also there is no signficant cleanup being done in the definition of the label.
As I stated previously, this is not accepted.
Jes
Quoted 4 lines · Dan Carpenter
Quoted 3 lines · Jes Sorensen
Quoted 2 lines · Hari Prasath (H.)
Remove the goto and return error directly thereby removing a variable
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Signed-off-by Hari Prasath Gujulan Elango <[email protected]>--- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)NACK!
SHOUTING!
It's normal to write NACK in upper case
Quoted 7 lines
Quoted 4 lines
The goto is cleaner and more consistent, rather than hiding a return in the middle of the code.
More consistent with what? There are already returns earlier in the function. Do-nothing gotos are pointless and annoying.
That is *your* preference!
Having returns scattered randomly throughout the code is annoying and hard to catch when reading the code!
This case is *not* a bug, so it comes down to personal preference of the maintainer. For code you maintain, feel free to do as you like, I will *not* never bother you for this kind of preference issues, I will tell you if I spot an actual bug.
This is one of the problems with checkpatch style tools, they have become harassment tools, for some people to impose their personal preferences onto others.
It would be so much more valuable if they just focused on real bugs!
Jes
Quoted 5 lines · Jes Sorensen
Quoted 3 lines · Dan Carpenter
Quoted 1 line · Jes Sorensen
NACK!
SHOUTING!
It's normal to write NACK in upper case
Not with an exclamation point.
Quoted 8 lines · Joe Perches
Quoted 5 lines · Jes Sorensen
Quoted 3 lines · Dan Carpenter
Quoted 1 line · Jes Sorensen
NACK!
SHOUTING!
It's normal to write NACK in upper case
Not with an exclamation point.
I would add a <blink> tag if ascii email allowed that!