Skip to contentSkip to conversation

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

PATCH In review Kirtika Ruchandani 5 participants 9 messages Nov 24, 2016 – Jan 18, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix -Wunused-but-set-variable in ath10k/

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 (5):
ath10k: Remove unused 'buf_len' variable
ath10k: Remove unused 'num_vdev_stats' variable
ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv
ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()
ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

 drivers/net/wireless/ath/ath10k/ahb.c     |  5 -----
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 --
 drivers/net/wireless/ath/ath10k/wmi.c     | 14 ++------------
 3 files changed, 2 insertions(+), 19 deletions(-)

A message that is not in the archive (sent off-list or not yet received): cover.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#2 lore raw

PATCH 2/5 ath10k: Remove unused 'num_vdev_stats' variable

Several functions for wmi stats parsing define and set num_vdev_stats but do not use it. Compiling with W=1 gives the following warnings, fix them.

drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_main_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2680:22: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]

  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
                      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10x_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2735:22: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
                      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_2_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2796:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_2_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2875:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2963:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^

These are harmless warnings and are only being fixed to reduce the noise with W=1 in the kernel.

Fixes d15fb5200664 ("ath10k: split wmi stats parsing")
Fixes 20de2229c634 ("ath10k: fix 10.2 fw stats parsing")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +0 -0
index 1f28187..10ec5a5 100644
@@ -2675,14 +2675,13 @@ static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar,

struct ath10k_fw_stats *stats)

 {
	const struct wmi_stats_event *ev = (void *)skb->data;
-	u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+	u32 num_pdev_stats, num_peer_stats;
	int i;

	if (!skb_pull(skb, sizeof(*ev)))
		return -EPROTO;

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2730,14 +2729,13 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar,
					   struct ath10k_fw_stats *stats)
 {
	const struct wmi_stats_event *ev = (void *)skb->data;
-	u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+	u32 num_pdev_stats, num_peer_stats;
	int i;

	if (!skb_pull(skb, sizeof(*ev)))
		return -EPROTO;

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2791,7 +2789,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	int i;

@@ -2800,7 +2797,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2870,7 +2866,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	int i;

@@ -2879,7 +2874,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2958,7 +2952,6 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	u32 num_bcnflt_stats;
	u32 stats_id;

@@ -2969,7 +2962,6 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
	num_bcnflt_stats = __le32_to_cpu(ev->num_bcnflt_stats);
	stats_id = __le32_to_cpu(ev->stats_id);

--
2.8.0.rc3.226.g39d4020

#3 lore raw

PATCH 3/5 ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv

In reply to a message not in the archive

Commit ca996ec56608 (ath10k: implement wmi-tlv backend)
introduced ath10k_wmi_tlv_op_gen_vdev_start() where
'struct wmi_p2p_noa_descriptor *noa' is defined and set but not used.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function ‘ath10k_wmi_tlv_op_gen_vdev_start’:
drivers/net/wireless/ath/ath10k/wmi-tlv.c:1647:33: warning: variable ‘noa’ set but not used [-Wunused-but-set-variable]

Fixes ca996ec56608 ("ath10k: implement wmi-tlv backend")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +0 -0
index e64f593..0e4bd29 100644
@@ -1644,7 +1644,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
 {
	struct wmi_tlv_vdev_start_cmd *cmd;
	struct wmi_channel *ch;
-	struct wmi_p2p_noa_descriptor *noa;
	struct wmi_tlv *tlv;
	struct sk_buff *skb;
	size_t len;
@@ -1702,7 +1701,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
	tlv = ptr;
	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT);
	tlv->len = 0;

- noa = (void *)tlv->value;

	/* Note: This is a nested TLV containing:
	 * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv]..

--
2.8.0.rc3.226.g39d4020

A message that is not in the archive (sent off-list or not yet received): 99d0ff42e57d5f62560e72d926b4d69d5d7c418b.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#5 lore raw

Re: [PATCH 3/5] ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv

Quoted 28 lines · Kirtika Ruchandani

Commit ca996ec56608 (ath10k: implement wmi-tlv backend)
introduced ath10k_wmi_tlv_op_gen_vdev_start() where
'struct wmi_p2p_noa_descriptor *noa' is defined and set but not used.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function ‘ath10k_wmi_tlv_op_gen_vdev_start’:
drivers/net/wireless/ath/ath10k/wmi-tlv.c:1647:33: warning: variable ‘noa’ set but not used [-Wunused-but-set-variable]

Fixes ca996ec56608 ("ath10k: implement wmi-tlv backend")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +0 -1
index e64f593..0e4bd29 100644
@@ -1644,7 +1644,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
 {
        struct wmi_tlv_vdev_start_cmd *cmd;
        struct wmi_channel *ch;
-       struct wmi_p2p_noa_descriptor *noa;
        struct wmi_tlv *tlv;
        struct sk_buff *skb;
        size_t len;

drivers/net/wireless/ath/ath10k/wmi-tlv.c ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar, · line 1706

Quoted 7 lines
drivers/net/wireless/ath/ath10k/wmi-tlv.c +0 -1
@@ -1702,7 +1701,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
        tlv = ptr;
        tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT);
        tlv->len = 0;
-       noa = (void *)tlv->value;
 
        /* Note: This is a nested TLV containing:
         * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv]..

I would rather keep this one as it serves as documentation. Would "(void) noa;" be enough satisfy the compiler?

Michał

#6 lore raw

Re: [3/5] ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv

In reply to a message not in the archive
Quoted 11 lines · Kirtika Ruchandani

Commit ca996ec56608 (ath10k: implement wmi-tlv backend)
introduced ath10k_wmi_tlv_op_gen_vdev_start() where
'struct wmi_p2p_noa_descriptor *noa' is defined and set but not used.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function ‘ath10k_wmi_tlv_op_gen_vdev_start’:
drivers/net/wireless/ath/ath10k/wmi-tlv.c:1647:33: warning: variable ‘noa’ set but not used [-Wunused-but-set-variable]

Fixes ca996ec56608 ("ath10k: implement wmi-tlv backend")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>

No response to Michal's comment by the author

Patch set to Changes Requested.

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

Documentation about submitting wireless patches and checking status
from patchwork:

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

PATCH 5/5 ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

In reply to a message not in the archive

Commit 704dc4e36769 introduced ath10k_ahb_resource_init() which defines and sets 'struct device* dev' but does not use it. Compiling with W=1 gives the following warning, fix it.

drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_resource_init’:
drivers/net/wireless/ath/ath10k/ahb.c:449:17: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes 704dc4e36769 ("ath10k: add resource init and deinit in ahb")
Cc Raja Mani <rmani-Rm6X0d1/[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath10k/ahb.c +0 -0
index 8078d64..19507fe 100644
@@ -443,12 +443,10 @@ static int ath10k_ahb_resource_init(struct ath10k *ar)
 {
	struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
	struct platform_device *pdev;
-	struct device *dev;
	struct resource *res;
	int ret;

	pdev = ar_ahb->pdev;

- dev = &pdev->dev;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {

--
2.8.0.rc3.226.g39d4020

#8 lore raw

PATCH 1/5 ath10k: Remove unused 'buf_len' variable

In reply to Kirtika Ruchandani

Commit 32653cf19554 removed the call to 'skb_trim(skb, buf_len)'
in ath10k_wmi_event_mgmt_rx(), leaving the buf_len variable set but
unused. Compiling with W=1 gives the following warning, fix it. drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_event_mgmt_rx’:
drivers/net/wireless/ath/ath10k/wmi.c:2280:6: warning: variable ‘buf_len’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes 32653cf19554 ("ath10k: implement intermediate event args")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +0 -0
index 387c4ee..1f28187 100644
@@ -2277,7 +2277,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
	u32 phy_mode;
	u32 snr;
	u32 rate;
-	u32 buf_len;
	u16 fc;
	int ret;

@@ -2289,7 +2288,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)

	}

	channel = __le32_to_cpu(arg.channel);
-	buf_len = __le32_to_cpu(arg.buf_len);
	rx_status = __le32_to_cpu(arg.status);
	snr = __le32_to_cpu(arg.snr);
	phy_mode = __le32_to_cpu(arg.phy_mode);

A message that is not in the archive (sent off-list or not yet received): 196e46eee00fd3ebb56da1373c36f3dff66f2ae1.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#10 lore raw

Re: [1/5] ath10k: Remove unused 'buf_len' variable

Quoted 6 lines · Kirtika Ruchandani

Commit 32653cf19554 removed the call to 'skb_trim(skb, buf_len)'
in ath10k_wmi_event_mgmt_rx(), leaving the buf_len variable set but
unused. Compiling with W=1 gives the following warning, fix it. drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_event_mgmt_rx’:
drivers/net/wireless/ath/ath10k/wmi.c:2280:6: warning: variable ‘buf_len’ set but not used [-Wunused-but-set-variable]

Quoted 7 lines

This is a harmless warning, and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes 32653cf19554 ("ath10k: implement intermediate event args")
Cc Michal Kazior <[email protected]>
Cc Kalle Valo <[email protected]>

These patches seem to be corrupted:

Applying: ath10k: Remove unused 'buf_len' variable
fatal: corrupt patch at line 13
error: could not build fake ancestor
Patch failed at 0001 ath10k: Remove unused 'buf_len' variable

When resending please also cc ath10k list:

https://wireless.wiki.kernel.org/en/users/drivers/ath10k/sources#submitting_patches

4 patches set to Changes Requested.

9444973 [1/5] ath10k: Remove unused 'buf_len' variable 9444935 [2/5] ath10k: Remove unused 'num_vdev_stats' variable 9444971 [4/5] ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable() 9444975 [5/5] ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

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

Documentation about submitting wireless patches and checking status
from patchwork:

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

PATCH 4/5 ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()

In reply to Kirtika Ruchandani

Commit 8beff219c528 introduced ath10k_ahb_clock_enable() which
defines and sets 'struct device* dev' but does not use it.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_clock_enable’:
drivers/net/wireless/ath/ath10k/ahb.c:133:17: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the noise with W=1 in the kernel.

Fixes 8beff219c528("ath10k: add clock ctrl related functions in ahb")
Cc Raja Mani <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/ath/ath10k/ahb.c +0 -0
index 766c63b..8078d64 100644
@@ -130,11 +130,8 @@ static void ath10k_ahb_clock_deinit(struct ath10k *ar)
 static int ath10k_ahb_clock_enable(struct ath10k *ar)
 {
	struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
-	struct device *dev;
	int ret;

- dev = &ar_ahb->pdev->dev;
-

	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk) ||
	    IS_ERR_OR_NULL(ar_ahb->ref_clk) ||
	    IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {

--
2.8.0.rc3.226.g39d4020