lkml.org 
[lkml]   [2021]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] staging: wfx: sta: Fix 'else' coding style warning
Date
Hello Srivathsa,

Thank for your suggestion. However ...

On Tuesday 14 September 2021 16:31:06 CEST Srivathsa Dara wrote:
> Fix 'else is not generally useful after a break or return' checkpatch
> warning
>
> Signed-off-by: Srivathsa Dara <srivathsa729.8@gmail.com>
> ---
> drivers/staging/wfx/sta.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
> index aceb18a1f54b..23c0425e3929 100644
> --- a/drivers/staging/wfx/sta.c
> +++ b/drivers/staging/wfx/sta.c
> @@ -169,19 +169,18 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
> if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps)
> dev_info(wvif->wdev->dev, "ignoring requested PS mode");
> return -1;
> - } else {
> - /* It is necessary to enable PS if channels
> - * are different.
> - */
> - if (enable_ps)
> - *enable_ps = true;
> - if (wvif->wdev->force_ps_timeout > -1)
> - return wvif->wdev->force_ps_timeout;
> - else if (wfx_api_older_than(wvif->wdev, 3, 2))
> - return 0;
> - else
> - return 30;
> }
> + /* It is necessary to enable PS if channels
> + * are different.
> + */
> + if (enable_ps)
> + *enable_ps = true;
> + if (wvif->wdev->force_ps_timeout > -1)
> + return wvif->wdev->force_ps_timeout;
> + else if (wfx_api_older_than(wvif->wdev, 3, 2))
> + return 0;
> + else
> + return 30;

I am not a big fan of blindly applying the hints from checkpatch. With
this patch, it seems that the code in the "if" branch is an exception
and the rest of the code is the general case.

But, it is not true. There are two cases, and the author (me in fact)
attended to express that that by using a "else" statement.


--
Jérôme Pouiller


\
 
 \ /
  Last update: 2021-09-17 16:35    [W:0.066 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site