[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20226182-81b2-92b9-d286-d9520a1d568b@lwfinger.net>
Date: Wed, 13 Apr 2022 11:51:41 -0500
From: Larry Finger <Larry.Finger@...inger.net>
To: Mahak Gupta <mahak_g@...iitr.ac.in>, phil@...lpotter.co.uk,
gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, outreachy@...ts.linux.dev
Subject: Re: [PATCH] staging: r8188eu: remove else after return and break
statements
On 4/13/22 00:27, Mahak Gupta wrote:
> Else is not necessary after return and break statements, hence remove
> it.
>
> Reported by checkpatch:
>
> WARNING: else is not generally useful after a break or return
>
> Signed-off-by: Mahak Gupta <mahak_g@...iitr.ac.in>
The commit message is redundant. I would suggest the following:
checkpatch reports the following:
WARNING: else is not generally useful after a break or return
Remove those cases.
> ---
> drivers/staging/r8188eu/core/rtw_ieee80211.c | 41 ++++++++------------
> 1 file changed, 17 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_ieee80211.c b/drivers/staging/r8188eu/core/rtw_ieee80211.c
> index 5a0e42ed4a47..bb4c9bc864da 100644
> --- a/drivers/staging/r8188eu/core/rtw_ieee80211.c
> +++ b/drivers/staging/r8188eu/core/rtw_ieee80211.c
> @@ -97,16 +97,15 @@ bool rtw_is_cckratesonly_included(u8 *rate)
>
> int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
> {
> - if (channel > 14) {
> + if (channel > 14)
> return WIRELESS_INVALID;
> - } else { /* could be pure B, pure G, or B/G */
> - if (rtw_is_cckratesonly_included(rate))
> - return WIRELESS_11B;
> - else if (rtw_is_cckrates_included(rate))
> - return WIRELESS_11BG;
> - else
> - return WIRELESS_11G;
> - }
> + /* could be pure B, pure G, or B/G */
> + if (rtw_is_cckratesonly_included(rate))
> + return WIRELESS_11B;
> + else if (rtw_is_cckrates_included(rate))
> + return WIRELESS_11BG;
> + else
> + return WIRELESS_11G;
Is this 'else' necessary?
Larry
Powered by blists - more mailing lists