[PATCH v2] wifi: ath12k: cleanup ath12k_mac_mlo_ready()

Ethan Carter Edwards posted 1 patch 10 months, 1 week ago
drivers/net/wireless/ath/ath12k/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH v2] wifi: ath12k: cleanup ath12k_mac_mlo_ready()
Posted by Ethan Carter Edwards 10 months, 1 week ago
There is a possibility for an uninitialized *ret* variable to be
returned in some code paths.

This explicitly returns 0 without an error. Also removes goto that
returned *ret* and simply returns in place.

Closes: https://scan5.scan.coverity.com/#/project-view/63541/10063?selectedIssue=1642337
Fixes: b716a10d99a28 ("wifi: ath12k: enable MLO setup and teardown from core")
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
Changes in v2:
- Rewrite commit subject to include function
- put int ret; back at top of function declaration
- minor changes to description
- Link to v1: https://lore.kernel.org/r/20250209-ath12k-uninit-v1-1-afc8005847be@ethancedwards.com
---
 drivers/net/wireless/ath/ath12k/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 0606116d6b9c491b6ede401b2e1aedfb619339a8..276f2ee553f4e3529abff14f2b9238ee0a78f45e 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -920,12 +920,11 @@ int ath12k_mac_mlo_ready(struct ath12k_hw_group *ag)
 			ar = &ah->radio[j];
 			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>
Re: [PATCH v2] wifi: ath12k: cleanup ath12k_mac_mlo_ready()
Posted by Jeff Johnson 10 months ago
On Mon, 10 Feb 2025 21:49:41 -0500, Ethan Carter Edwards wrote:
> There is a possibility for an uninitialized *ret* variable to be
> returned in some code paths.
> 
> This explicitly returns 0 without an error. Also removes goto that
> returned *ret* and simply returns in place.
> 
> 
> [...]

Applied, thanks!

[1/1] wifi: ath12k: cleanup ath12k_mac_mlo_ready()
      commit: ceb3b35f5ef4a0c490f54eb8b53075fd83a97d11

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Re: [PATCH v2] wifi: ath12k: cleanup ath12k_mac_mlo_ready()
Posted by Jeff Johnson 10 months, 1 week ago
On 2/10/2025 6:49 PM, Ethan Carter Edwards wrote:
> There is a possibility for an uninitialized *ret* variable to be
> returned in some code paths.
> 
> This explicitly returns 0 without an error. Also removes goto that
> returned *ret* and simply returns in place.
> 
> Closes: https://scan5.scan.coverity.com/#/project-view/63541/10063?selectedIssue=1642337
> Fixes: b716a10d99a28 ("wifi: ath12k: enable MLO setup and teardown from core")

In the pending branch I changed this to:
Fixes: b716a10d99a2 ("wifi: ath12k: enable MLO setup and teardown from core")

To fix the checkpatch issue:
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: b716a10d99a2 ("wifi: ath12k: enable MLO setup and teardown from core")'

https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git/commit/?h=pending&id=c2f7ae223cd3d781c69337dc804f1fae95789cdd
Re: [PATCH v2] wifi: ath12k: cleanup ath12k_mac_mlo_ready()
Posted by Aditya Kumar Singh 10 months, 1 week ago
On 2/11/25 08:19, Ethan Carter Edwards wrote:
> There is a possibility for an uninitialized*ret* variable to be
> returned in some code paths.
> 
> This explicitly returns 0 without an error. Also removes goto that
> returned*ret* and simply returns in place.
> 
> Closes:https://scan5.scan.coverity.com/#/project-view/63541/10063? 
> selectedIssue=1642337
> Fixes: b716a10d99a28 ("wifi: ath12k: enable MLO setup and teardown from core")
> Signed-off-by: Ethan Carter Edwards<ethan@ethancedwards.com>
> ---

Reviewed-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>

-- 
Aditya