From: Len Baker <len.baker@gmx.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <keescook@chromium.org>
Cc: Len Baker <len.baker@gmx.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
Michael Straube <straube.linux@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: [PATCH v2 2/3] staging/rtl8192u: Initialize variables in the definition block
Date: Tue, 24 Aug 2021 10:59:58 +0200 [thread overview]
Message-ID: <20210824073643.GA7396@titan> (raw)
In-Reply-To: <20210824072545.7321-1-len.baker@gmx.com>
Initialize the pre_cmd_cnt, post_cmd_cnt and rf_cmd_cnt variables in the
definition block as it is not necessary to do this in the middle of the
function.
Signed-off-by: Len Baker <len.baker@gmx.com>
---
drivers/staging/rtl8192u/r819xU_phy.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index 6a67708cdd89..ff6fe2ee3349 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1186,11 +1186,11 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
{
struct r8192_priv *priv = ieee80211_priv(dev);
struct sw_chnl_cmd *pre_cmd;
- u32 pre_cmd_cnt;
+ u32 pre_cmd_cnt = 0;
struct sw_chnl_cmd *post_cmd;
- u32 post_cmd_cnt;
+ u32 post_cmd_cnt = 0;
struct sw_chnl_cmd *rf_cmd;
- u32 rf_cmd_cnt;
+ u32 rf_cmd_cnt = 0;
struct sw_chnl_cmd *current_cmd = NULL;
u8 e_rfpath;
bool ret;
@@ -1225,7 +1225,6 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
/* FIXME: need to check whether channel is legal or not here */
/* <1> Fill up pre common command. */
- pre_cmd_cnt = 0;
rtl8192_phy_SetSwChnlCmdArray(pre_cmd, pre_cmd_cnt++,
MAX_PRECMD_CNT, CMD_ID_SET_TX_PWR_LEVEL,
0, 0, 0);
@@ -1233,12 +1232,10 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
MAX_PRECMD_CNT, CMD_ID_END, 0, 0, 0);
/* <2> Fill up post common command. */
- post_cmd_cnt = 0;
rtl8192_phy_SetSwChnlCmdArray(post_cmd, post_cmd_cnt++,
MAX_POSTCMD_CNT, CMD_ID_END, 0, 0, 0);
/* <3> Fill up RF dependent command. */
- rf_cmd_cnt = 0;
switch (priv->rf_chip) {
case RF_8225:
if (!(channel >= 1 && channel <= 14)) {
--
2.25.1
next prev parent reply other threads:[~2021-08-24 9:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 7:25 [PATCH v2 0/3] staging/rtl8192u: Prefer kcalloc over open coded arithmetic Len Baker
2021-08-24 7:25 ` [PATCH v2 1/3] staging/rtl8192u: Avoid CamelCase in names of variables Len Baker
2021-08-24 8:59 ` Len Baker [this message]
2021-08-24 9:00 ` [PATCH v2 3/3] staging/rtl8192u: Prefer kcalloc over open coded arithmetic Len Baker
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=20210824073643.GA7396@titan \
--to=len.baker@gmx.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=lee.jones@linaro.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=straube.linux@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