public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: ath12k: Fix uninitialized variable and remove goto
@ 2025-02-10  4:36 Ethan Carter Edwards
  2025-02-11  1:08 ` Jeff Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Ethan Carter Edwards @ 2025-02-10  4:36 UTC (permalink / raw)
  To: Kalle Valo, Karthikeyan Periyasamy
  Cc: Jeff Johnson, Harshitha Prem, Kalle Valo, Jeff Johnson,
	linux-wireless, ath12k, linux-kernel, linux-hardening,
	linux-hardening, Ethan Carter Edwards

There is a possibility for an uninitialized *ret* variable to be
returned in some code paths.

This moves *ret* inside the conditional and explicitly returns 0 without
an error. Also removes goto that returned *ret*.

Addresses-Coverity-ID: 1642337 ("Uninitialized scalar variable")
Fixes: b716a10d99a28 ("wifi: ath12k: enable MLO setup and teardown from core")
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
 drivers/net/wireless/ath/ath12k/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 0606116d6b9c491b6ede401b2e1aedfb619339a8..ae75cdad3bd6b6eb80a35fee94c18d365d123cbd 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -908,7 +908,6 @@ int ath12k_mac_mlo_ready(struct ath12k_hw_group *ag)
 {
 	struct ath12k_hw *ah;
 	struct ath12k *ar;
-	int ret;
 	int i, j;
 
 	for (i = 0; i < ag->num_hw; i++) {
@@ -918,14 +917,13 @@ int ath12k_mac_mlo_ready(struct ath12k_hw_group *ag)
 
 		for_each_ar(ah, ar, j) {
 			ar = &ah->radio[j];
-			ret = __ath12k_mac_mlo_ready(ar);
+			int ret = __ath12k_mac_mlo_ready(ar);
 			if (ret)
-				goto out;
+				return ret;
 		}
 	}
 
-out:
-	return ret;
+	return 0;
 }
 
 static int ath12k_core_mlo_setup(struct ath12k_hw_group *ag)

---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-ath12k-uninit-18560fd91c07

Best regards,
-- 
Ethan Carter Edwards <ethan@ethancedwards.com>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-13  0:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  4:36 [PATCH] wifi: ath12k: Fix uninitialized variable and remove goto Ethan Carter Edwards
2025-02-11  1:08 ` Jeff Johnson
2025-02-11  2:28   ` Ethan Carter Edwards
2025-02-11  4:09     ` Ping-Ke Shih
2025-02-12 17:05       ` Jeff Johnson
2025-02-13  0:37         ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox