Skip to contentSkip to conversation

Fix -Wunused-but-set-variable in mwifiex/

PATCH Superseded Kirtika Ruchandani 3 participants 10 messages Nov 18, 2016 – Nov 23, 2016 Marvell mwifiex wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover 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.

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

#1 lore raw

PATCH 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]>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/main.c +0 -3
index 2478ccd..fff96be 100644
@@ -517,7 +517,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;
 	struct semaphore *sem = adapter->card_sem;
@@ -575,8 +574,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

#2 lore raw

Re: [1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable

Quoted 10 lines · Kirtika Ruchandani

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]>

Failed to apply to wireless-drivers-next:

Applying: mwifiex: Remove unused 'pm_flag' variable
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/marvell/mwifiex/sdio.c
CONFLICT (content): Merge conflict in drivers/net/wireless/marvell/mwifiex/sdio.c Failed to merge in the changes.
Patch failed at 0001 mwifiex: Remove unused 'pm_flag' variable

7 patches set to Changes Requested.

9435943 [1/7] mwifiex: Removed unused mwifiex_private* 'priv' variable 9435945 [2/7] mwifiex: Remove unused 'chan_num' variable 9435947 [3/7] mwifiex: Remove unused 'sta_ptr' variable 9435949 [4/7] mwifiex: Remove unused 'adapter'variable 9435951 [5/7] mwifiex: Remove unused 'pm_flag' variable 9435953 [6/7] mwifiex: Removed unused 'pkt_type' variable 9435955 [7/7] mwifiex: Remove unused 'bcd_usb' variable

Signature · 6 lines
https://patchwork.kernel.org/patch/9435943/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH 2/7 mwifiex: Remove unused 'chan_num' variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/marvell/mwifiex/scan.c +3 -5
index 97c9765..436e628 100644
@@ -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

#4 lore raw

PATCH 3/7 mwifiex: Remove unused 'sta_ptr' variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_cmd.c +0 -2
index 2a162c3..d5aa1b7 100644
@@ -1729,7 +1729,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;
@@ -1747,7 +1746,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

#5 lore raw

PATCH 4/7 mwifiex: Remove unused 'adapter'variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -2
index 39ce76a..dd93cda 100644
@@ -3970,13 +3970,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

#6 lore raw

PATCH 5/7 mwifiex: Remove unused 'pm_flag' variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/sdio.c +0 -2
index 8718950..41ec59d7 100644
@@ -231,10 +231,8 @@ 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;
 
 	if (func) {
-		pm_flag = sdio_get_host_pm_caps(func);
 		card = sdio_get_drvdata(func);
 		if (!card || !card->adapter) {
 			pr_err("resume: invalid card or adapter\n");

--
2.8.0.rc3.226.g39d4020

#7 lore raw

PATCH 6/7 mwifiex: Removed unused 'pkt_type' variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/sdio.c +0 -3
index 41ec59d7..4028a8c 100644
@@ -1193,7 +1193,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;
@@ -1214,8 +1213,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

#8 lore raw

PATCH 7/7 mwifiex: Remove unused 'bcd_usb' variable

In reply to Kirtika Ruchandani

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]>
---
 drivers/net/wireless/marvell/mwifiex/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/usb.c +1 -2
index 73eb084..67a15c1 100644
@@ -380,7 +380,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 = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
 	if (!card)
@@ -389,7 +389,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

Acked-by on the v1 series
#9 lore raw
In reply to Kirtika Ruchandani
Quoted 4 lines · CET Kirtika Ruchandani

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.

All seven patches look good to me, nice cleanup!