From: Pavel Skripkin <paskripkin@gmail.com>
To: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
outreachy@lists.linux.dev
Subject: Re: [PATCH] staging: r8188eu: simplify control flow
Date: Sun, 3 Apr 2022 18:59:26 +0300 [thread overview]
Message-ID: <ed0e9f7b-9ba9-b0c8-8261-397bf793b9b9@gmail.com> (raw)
In-Reply-To: <20220403155111.GA333187@euclid>
Hi Sevinj,
On 4/3/22 18:51, Sevinj Aghayeva wrote:
> The function iterates an index from 0 to NUM_PMKID_CACHE and returns
> the first index for which the condition is true. If no such index is
> found, the function returns -1. Current code has a complex control
> flow that obfuscates this simple task. Replace it with a loop.
>
> Also, given the shortened function body, replace the long variable
> name psecuritypriv with a short variable name p.
>
> Reported by checkpatch:
>
> WARNING: else is not generally useful after a break or return
>
> Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
> ---
[code snip]
> + for (i = 0; i < NUM_PMKID_CACHE; i++)
> + if ((p->PMKIDList[i].bUsed) &&
> + (!memcmp(p->PMKIDList[i].Bssid, bssid, ETH_ALEN)))
> + return i;
> + return -1;
> }
>
> /* */
Looks good, but let's not introduce new checkpatch issue:
CHECK: Alignment should match open parenthesis
#62: FILE: drivers/staging/r8188eu/core/rtw_mlme.c:1645:
+ if ((p->PMKIDList[i].bUsed) &&
+ (!memcmp(p->PMKIDList[i].Bssid, bssid, ETH_ALEN)))
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2022-04-03 15:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-03 15:51 [PATCH] staging: r8188eu: simplify control flow Sevinj Aghayeva
2022-04-03 15:59 ` Pavel Skripkin [this message]
2022-04-03 16:12 ` Sevinj Aghayeva
2022-04-03 16:16 ` Pavel Skripkin
2022-04-03 16:29 ` Sevinj Aghayeva
2022-04-03 16:43 ` Michael Straube
2022-04-03 16:59 ` Sevinj Aghayeva
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=ed0e9f7b-9ba9-b0c8-8261-397bf793b9b9@gmail.com \
--to=paskripkin@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
--cc=sevinj.aghayeva@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