From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, Srivathsa Dara <srivathsa729.8@gmail.com>
Subject: Re: [PATCH] staging: wfx: sta: Fix 'else' coding style warning
Date: Fri, 17 Sep 2021 16:33:50 +0200 [thread overview]
Message-ID: <3459215.8gJYjjsDaa@pc-42> (raw)
In-Reply-To: <20210914143107.18436-1-srivathsa729.8@gmail.com>
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
next prev parent reply other threads:[~2021-09-17 14:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 14:31 [PATCH] staging: wfx: sta: Fix 'else' coding style warning Srivathsa Dara
2021-09-14 14:56 ` Dan Carpenter
2021-09-17 14:24 ` Greg KH
2021-09-17 14:33 ` Jérôme Pouiller [this message]
2021-09-17 14:59 ` Greg KH
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=3459215.8gJYjjsDaa@pc-42 \
--to=jerome.pouiller@silabs.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=srivathsa729.8@gmail.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