2016-11-24 01:24:31

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 0/7] Fix -Wunused-but-set-variable in mwifiex/

This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

Acked-by: Arnd Bergmann <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>

---
Changes in v2:
- Reapplied patches on top of wireless-drivers-next.
- Patch 5/7 ("mwifiex: Remove unused 'pm_flag' variable") had to be
redone slightly. The others applied cleanly with 'patch -p1'.

Kirtika Ruchandani (7):
mwifiex: Removed unused mwifiex_private* 'priv' variable
mwifiex: Remove unused 'chan_num' variable
mwifiex: Remove unused 'sta_ptr' variable
mwifiex: Remove unused 'adapter'variable
mwifiex: Remove unused 'pm_flag' variable
mwifiex: Removed unused 'pkt_type' variable
mwifiex: Remove unused 'bcd_usb' variable

drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-----
drivers/net/wireless/marvell/mwifiex/sdio.c | 5 -----
drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 --
drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
6 files changed, 4 insertions(+), 19 deletions(-)

--
2.8.0.rc3.226.g39d4020


2016-11-24 01:26:31

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 5/7] mwifiex: Remove unused 'pm_flag' variable

mwifiex_sdio_resume() intializes pm_flag, just like
mwifiex_sdio_suspend(), but does not use it. Compiling with W=1 gives
the following warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_sdio_resume’:
mwifiex/sdio.c:234:16: warning: variable ‘pm_flag’ set but not used [-Wunused-but-set-variable]

sdio_get_host_pm_caps() is just an acessor, so the call to it is safe
to remove. The unused variable seems to be present since
5e6e3a92b9a4 which introduced mwifiex_sdio_resume().

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Cc: Bing Zhao <[email protected]>
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/sdio.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 0d00db5..6c9f16e 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -186,9 +186,7 @@ static int mwifiex_sdio_resume(struct device *dev)
struct sdio_func *func = dev_to_sdio_func(dev);
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
- mmc_pm_flag_t pm_flag = 0;

- pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
dev_err(dev, "resume: invalid card or adapter\n");
--
2.8.0.rc3.226.g39d4020

2016-11-24 01:24:46

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable

Commit bec568ff5107 removed the last remaining usage of struct
mwifiex_private* priv in mwifiex_fw_dpc(), by removing the call to
mwifiex_del_virtual_intf().
Compiling mwifiex/ with W=1 gives the following warning, fix it.
mwifiex/main.c: In function ‘mwifiex_fw_dpc’:
mwifiex/main.c:520:26: warning: variable ‘priv’ set but not used [-Wunused-but-set-variable]

Fixes: bec568ff5107 ("mwifiex: failure path handling in mwifiex_add_virtual_intf()")
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index eac44fe..e5c3a8a 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -518,7 +518,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
{
int ret;
char fmt[64];
- struct mwifiex_private *priv;
struct mwifiex_adapter *adapter = context;
struct mwifiex_fw_image fw;
bool init_failed = false;
@@ -576,8 +575,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
goto err_init_fw;
}

- priv = adapter->priv[MWIFIEX_BSS_ROLE_STA];
-
if (!adapter->wiphy) {
if (mwifiex_register_cfg80211(adapter)) {
mwifiex_dbg(adapter, ERROR,
--
2.8.0.rc3.226.g39d4020

2016-11-24 01:27:16

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 7/7] mwifiex: Remove unused 'bcd_usb' variable

mwifiex_usb_probe() defines and sets bcd_usb but does not use it,
Compiling with W=1 gives the following warning, fix it.
mwifiex/usb.c: In function ‘mwifiex_usb_probe’:
mwifiex/usb.c:383:41: warning: variable ‘bcd_usb’ set but not used [-Wunused-but-set-variable]

The unused variable seems to be present since 4daffe354366 which introduced
mwifiex_usb_probe().

Fixes: 4daffe354366 ("mwifiex: add support for Marvell USB8797 chipset")
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
index c3f696a..c563160 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -379,7 +379,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
struct usb_endpoint_descriptor *epd;
int ret, i;
struct usb_card_rec *card;
- u16 id_vendor, id_product, bcd_device, bcd_usb;
+ u16 id_vendor, id_product, bcd_device;

card = devm_kzalloc(&intf->dev, sizeof(*card), GFP_KERNEL);
if (!card)
@@ -390,7 +390,6 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
id_vendor = le16_to_cpu(udev->descriptor.idVendor);
id_product = le16_to_cpu(udev->descriptor.idProduct);
bcd_device = le16_to_cpu(udev->descriptor.bcdDevice);
- bcd_usb = le16_to_cpu(udev->descriptor.bcdUSB);
pr_debug("info: VID/PID = %X/%X, Boot2 version = %X\n",
id_vendor, id_product, bcd_device);

--
2.8.0.rc3.226.g39d4020

2016-11-24 01:25:57

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 4/7] mwifiex: Remove unused 'adapter'variable

Commit 3935ccc14d2c introduced mwifiex_tm_cmd() which initializes
struct mwifiex_adapter* adapter, but doesn't use it.
Compiling with W=1 gives the following warning, fix it.
mwifiex/cfg80211.c: In function ‘mwifiex_tm_cmd’:
mwifiex/cfg80211.c:3973:26: warning: variable ‘adapter’ set but not used [-Wunused-but-set-variable]

Fixes: 3935ccc14d2c ("mwifiex: add cfg80211 testmode support")
Cc: Xinming Hu <[email protected]>
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index c26469a..a231f09 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3980,13 +3980,11 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
struct mwifiex_ds_misc_cmd *hostcmd;
struct nlattr *tb[MWIFIEX_TM_ATTR_MAX + 1];
- struct mwifiex_adapter *adapter;
struct sk_buff *skb;
int err;

if (!priv)
return -EINVAL;
- adapter = priv->adapter;

err = nla_parse(tb, MWIFIEX_TM_ATTR_MAX, data, len,
mwifiex_tm_policy);
--
2.8.0.rc3.226.g39d4020

2016-11-24 01:25:40

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 3/7] mwifiex: Remove unused 'sta_ptr' variable

Commit 429d90d2212b introduced mwifiex_cmd_tdls_oper() which initializes
struct mwifiex_sta_node* sta_ptr, but does not use it. Compiling with W=1 gives
the following warning, fix it.
mwifiex/sta_cmd.c: In function ‘mwifiex_cmd_tdls_oper’:
mwifiex/sta_cmd.c:1732:27: warning: variable ‘sta_ptr’ set but not used [-Wunused-but-set-variable]

Fixes: 429d90d2212b ("mwifiex: add cfg80211 tdls_oper handler support")
Cc: Avinash Patil <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index bcd6408..768c519 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -1746,7 +1746,6 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
{
struct host_cmd_ds_tdls_oper *tdls_oper = &cmd->params.tdls_oper;
struct mwifiex_ds_tdls_oper *oper = data_buf;
- struct mwifiex_sta_node *sta_ptr;
struct host_cmd_tlv_rates *tlv_rates;
struct mwifiex_ie_types_htcap *ht_capab;
struct mwifiex_ie_types_qos_info *wmm_qos_info;
@@ -1764,7 +1763,6 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,

tdls_oper->reason = 0;
memcpy(tdls_oper->peer_mac, oper->peer_mac, ETH_ALEN);
- sta_ptr = mwifiex_get_sta_entry(priv, oper->peer_mac);

pos = (u8 *)tdls_oper + sizeof(struct host_cmd_ds_tdls_oper);

--
2.8.0.rc3.226.g39d4020

2016-11-24 01:27:02

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 6/7] mwifiex: Removed unused 'pkt_type' variable

Commit 92263a841b15 introduced mwifiex_deaggr_sdio_pkt which initializes
variable pkt_type but does not use it. Compiling with W=1 gives the following
warning, fix it.
mwifiex/sdio.c: In function ‘mwifiex_deaggr_sdio_pkt’:
mwifiex/sdio.c:1198:6: warning: variable ‘pkt_type’ set but not used [-Wunused-but-set-variable]

Fixes: 92263a841b15 ("mwifiex: add SDIO rx single port aggregation")
Cc: Zhaoyang Liu <[email protected]>
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/sdio.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 6c9f16e..09c586f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1134,7 +1134,6 @@ static void mwifiex_deaggr_sdio_pkt(struct mwifiex_adapter *adapter,
{
u32 total_pkt_len, pkt_len;
struct sk_buff *skb_deaggr;
- u32 pkt_type;
u16 blk_size;
u8 blk_num;
u8 *data;
@@ -1155,8 +1154,6 @@ static void mwifiex_deaggr_sdio_pkt(struct mwifiex_adapter *adapter,
break;
}
pkt_len = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET));
- pkt_type = le16_to_cpu(*(__le16 *)(data + SDIO_HEADER_OFFSET +
- 2));
if ((pkt_len + SDIO_HEADER_OFFSET) > blk_size) {
mwifiex_dbg(adapter, ERROR,
"%s: error in pkt_len,\t"
--
2.8.0.rc3.226.g39d4020

2016-11-24 01:25:00

by Kirtika Ruchandani

[permalink] [raw]
Subject: [PATCH v2 2/7] mwifiex: Remove unused 'chan_num' variable

Commit b5413e6b2228 removed all uses of chan_num in mwifiex_config_scan().
Compiling mwifiex with W=1 gives the following warning, fix it.

mwifiex/scan.c: In function ‘mwifiex_config_scan’:
mwifiex/scan.c:830:6: warning: variable ‘chan_num’ set but not used [-Wunused-but-set-variable]

Fixes: b5413e6b2228 ("mwifiex: increase the number of nodes in command pool")
Cc: Amitkumar Karwar <[email protected]>
Signed-off-by: Kirtika Ruchandani <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index 98ce072..1816916 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -827,7 +827,6 @@ mwifiex_config_scan(struct mwifiex_private *priv,
u32 num_probes;
u32 ssid_len;
u32 chan_idx;
- u32 chan_num;
u32 scan_type;
u16 scan_dur;
u8 channel;
@@ -1105,13 +1104,12 @@ mwifiex_config_scan(struct mwifiex_private *priv,
mwifiex_dbg(adapter, INFO,
"info: Scan: Scanning current channel only\n");
}
- chan_num = chan_idx;
} else {
mwifiex_dbg(adapter, INFO,
"info: Scan: Creating full region channel list\n");
- chan_num = mwifiex_scan_create_channel_list(priv, user_scan_in,
- scan_chan_list,
- *filtered_scan);
+ mwifiex_scan_create_channel_list(priv, user_scan_in,
+ scan_chan_list,
+ *filtered_scan);
}

}
--
2.8.0.rc3.226.g39d4020

2016-11-24 07:55:41

by Amitkumar Karwar

[permalink] [raw]
Subject: RE: [PATCH v2 0/7] Fix -Wunused-but-set-variable in mwifiex/

> From: Kirtika Ruchandani [mailto:[email protected]]
> Sent: Thursday, November 24, 2016 6:54 AM
> To: Amitkumar Karwar
> Cc: Arnd Bergmann; Kalle Valo; [email protected]; Nishant
> Sarmukadam; Zhaoyang Liu; Bing Zhao; Xinming Hu; Avinash Patil
> Subject: [PATCH v2 0/7] Fix -Wunused-but-set-variable in mwifiex/
>
> This patchset is part of the effort led by Arnd Bergmann to clean up
> warnings in the kernel. This and following patchsets will focus on "-
> Wunused-but-set-variable" as it among the noisier ones. These were
> found compiling with W=1.
>
> Acked-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Kirtika Ruchandani <[email protected]>
>
> ---
> Changes in v2:
> - Reapplied patches on top of wireless-drivers-next.
> - Patch 5/7 ("mwifiex: Remove unused 'pm_flag' variable") had to be
> redone slightly. The others applied cleanly with 'patch -p1'.
>
> Kirtika Ruchandani (7):
> mwifiex: Removed unused mwifiex_private* 'priv' variable
> mwifiex: Remove unused 'chan_num' variable
> mwifiex: Remove unused 'sta_ptr' variable
> mwifiex: Remove unused 'adapter'variable
> mwifiex: Remove unused 'pm_flag' variable
> mwifiex: Removed unused 'pkt_type' variable
> mwifiex: Remove unused 'bcd_usb' variable
>
> drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
> drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
> drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-----
> drivers/net/wireless/marvell/mwifiex/sdio.c | 5 -----
> drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 --
> drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
> 6 files changed, 4 insertions(+), 19 deletions(-)
>
> --

Thanks for this cleanup work.
Patch series looks fine to me.

Acked-by: Amitkumar Karwar <[email protected]>

Regards,
Amitkumar

2016-11-29 15:28:16

by Kalle Valo

[permalink] [raw]
Subject: Re: [v2, 1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable

Kirtika Ruchandani <[email protected]> wrote:
> Commit bec568ff5107 removed the last remaining usage of struct
> mwifiex_private* priv in mwifiex_fw_dpc(), by removing the call to
> mwifiex_del_virtual_intf().
> Compiling mwifiex/ with W=1 gives the following warning, fix it.
> mwifiex/main.c: In function ‘mwifiex_fw_dpc’:
> mwifiex/main.c:520:26: warning: variable ‘priv’ set but not used [-Wunused-but-set-variable]
>
> Fixes: bec568ff5107 ("mwifiex: failure path handling in mwifiex_add_virtual_intf()")
> Cc: Amitkumar Karwar <[email protected]>
> Signed-off-by: Kirtika Ruchandani <[email protected]>

7 patches applied to wireless-drivers-next.git, thanks.

70d740598713 mwifiex: Removed unused mwifiex_private* 'priv' variable
8ac9134161d9 mwifiex: Remove unused 'chan_num' variable
2c2bcabf02e1 mwifiex: Remove unused 'sta_ptr' variable
60261b266a84 mwifiex: Remove unused 'adapter'variable
e9f1db8b6859 mwifiex: Remove unused 'pm_flag' variable
67dd2a754906 mwifiex: Removed unused 'pkt_type' variable
4133828c76c3 mwifiex: Remove unused 'bcd_usb' variable

--
https://patchwork.kernel.org/patch/9444651/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches