diff mbox series

[1/4] wifi: ath12k: Fix uninitilized variable clang warnings

Message ID 20221221105529.19345-2-quic_tmariyap@quicinc.com
State New
Headers show
Series Fix clang warnings | expand

Commit Message

Thiraviyam Mariyappan Dec. 21, 2022, 10:55 a.m. UTC
Fix uninitilized variable warnings spotted during clang compilation.

Warnings:
drivers/net/wireless/ath/ath12k/mac.c:1076:8: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
drivers/net/wireless/ath/ath12k/dbring.c:272:7: warning: variable 'ring' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
drivers/net/wireless/ath/ath12k/dp_rx.c:2690:34: warning: variable 'i' is uninitialized when used here [-Wuninitialized]

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-03171-QCAHKSWPL_SILICONZ-1
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thiraviyam Mariyappan <quic_tmariyap@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dbring.c | 2 +-
 drivers/net/wireless/ath/ath12k/dp_rx.c  | 3 +--
 drivers/net/wireless/ath/ath12k/mac.c    | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

Comments

Kalle Valo Jan. 18, 2023, 6:38 a.m. UTC | #1
Thiraviyam Mariyappan <quic_tmariyap@quicinc.com> wrote:

> Fix uninitilized variable warnings spotted during clang compilation.
> 
> Warnings:
> drivers/net/wireless/ath/ath12k/mac.c:1076:8: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> drivers/net/wireless/ath/ath12k/dbring.c:272:7: warning: variable 'ring' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
> drivers/net/wireless/ath/ath12k/dp_rx.c:2690:34: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-03171-QCAHKSWPL_SILICONZ-1
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Thiraviyam Mariyappan <quic_tmariyap@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

4 patches applied to ath-next branch of ath.git, thanks.

d1335f0dc18f wifi: ath12k: Fix uninitilized variable clang warnings
b57f03200853 wifi: ath12k: hal_rx: Use memset_startat() for clearing queue descriptors
80166c42434c wifi: ath12k: dp_mon: Fix out of bounds clang warning
2ee25c257d17 wifi: ath12k: dp_mon: Fix uninitialized warning related to the pktlog
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dbring.c b/drivers/net/wireless/ath/ath12k/dbring.c
index 9aa2631be1a8..8fbf868e6f7e 100644
--- a/drivers/net/wireless/ath/ath12k/dbring.c
+++ b/drivers/net/wireless/ath/ath12k/dbring.c
@@ -230,7 +230,7 @@  int ath12k_dbring_get_cap(struct ath12k_base *ab,
 int ath12k_dbring_buffer_release_event(struct ath12k_base *ab,
 				       struct ath12k_dbring_buf_release_event *ev)
 {
-	struct ath12k_dbring *ring;
+	struct ath12k_dbring *ring = NULL;
 	struct hal_srng *srng;
 	struct ath12k *ar;
 	struct ath12k_dbring_element *buff;
diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index d6835d13f7ec..83a43ad48c51 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -2582,7 +2582,6 @@  int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id,
 	struct sk_buff *msdu;
 	bool done = false;
 	int mac_id;
-	int i;
 	u64 desc_va;
 
 	__skb_queue_head_init(&msdu_list);
@@ -2687,7 +2686,7 @@  int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id,
 		goto exit;
 
 	/* TODO: Move to implicit BM? */
-	ath12k_dp_rx_bufs_replenish(ab, i, rx_ring, num_buffs_reaped,
+	ath12k_dp_rx_bufs_replenish(ab, 0, rx_ring, num_buffs_reaped,
 				    ab->hw_params->hal_params->rx_buf_rbm, true);
 
 	ath12k_dp_rx_process_received_packets(ab, napi, &msdu_list,
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index ac6548c087ba..bf7e5b6977b2 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1057,7 +1057,7 @@  static int ath12k_mac_op_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct ath12k *ar = hw->priv;
 	struct ieee80211_conf *conf = &hw->conf;
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -1089,7 +1089,7 @@  static int ath12k_mac_op_config(struct ieee80211_hw *hw, u32 changed)
 err_mon_del:
 	ath12k_mac_monitor_vdev_delete(ar);
 	mutex_unlock(&ar->conf_mutex);
-	return 0;
+	return ret;
 }
 
 static int ath12k_mac_setup_bcn_tmpl(struct ath12k_vif *arvif)