Skip to contentSkip to conversation

wifi: ath11k: clean-up during wrong ath11k_crypto_mode

PATCH In review Rodrigo Gobbi 3 participants 3 messages May 15, 2025 – May 16, 2025 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: ath11k: clean-up during wrong ath11k_crypto_mode

if ath11k_crypto_mode is invalid (not ATH11K_CRYPT_MODE_SW/ATH11K_CRYPT_MODE_HW), ath11k_core_qmi_firmware_ready() will not undo some actions that was previously started/configured. It's reasonable to undo things during this condition, fixing the following smatch warning:

drivers/net/wireless/ath/ath11k/core.c:2166 ath11k_core_qmi_firmware_ready()
warn: missing unwind goto?

---
Changelog:
v2: add smatch warn at commit msg
v1: https://lore.kernel.org/linux-wireless/[email protected]/

---
 drivers/net/wireless/ath/ath11k/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/core.c +3 -1
index 2e9f8a5e61e4..fd3017c444a4 100644
@@ -2163,7 +2163,9 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		break;
 	default:
 		ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
-		return -EINVAL;
+		ret = -EINVAL;
+		ath11k_dp_free(ab);
+		goto err_firmware_stop;
 	}
 
 	if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
Signature · 1 line
2.49.0
#1 lore raw
Quoted 22 lines · Rodrigo Gobbi

if ath11k_crypto_mode is invalid (not ATH11K_CRYPT_MODE_SW/ATH11K_CRYPT_MODE_HW), ath11k_core_qmi_firmware_ready() will not undo some actions that was previously started/configured. It's reasonable to undo things during this condition, fixing the following smatch warning:

drivers/net/wireless/ath/ath11k/core.c:2166 ath11k_core_qmi_firmware_ready()
warn: missing unwind goto?

---
Changelog:
v2: add smatch warn at commit msg
v1: https://lore.kernel.org/linux-wireless/[email protected]/

---
 drivers/net/wireless/ath/ath11k/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/core.c +0 -0
index 2e9f8a5e61e4..fd3017c444a4 100644

drivers/net/wireless/ath/ath11k/core.c int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab) · line 2169

Quoted 8 lines
drivers/net/wireless/ath/ath11k/core.c +3 -1
@@ -2163,7 +2163,9 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		break;
 	default:
 		ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
-		return -EINVAL;
+		ret = -EINVAL;
+		ath11k_dp_free(ab);
+		goto err_firmware_stop;
 	}

Instead, how about moving the ath11k_crypto_mode validating to the top of ath11k_core_qmi_firmware_ready()?

Quoted 2 lines
drivers/net/wireless/ath/ath11k/core.c +0 -0
 	if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
#2 lore raw
In reply to Rodrigo Gobbi
Quoted 8 lines · Rodrigo Gobbi

if ath11k_crypto_mode is invalid (not ATH11K_CRYPT_MODE_SW/ATH11K_CRYPT_MODE_HW), ath11k_core_qmi_firmware_ready() will not undo some actions that was previously started/configured. It's reasonable to undo things during this condition, fixing the following smatch warning:

drivers/net/wireless/ath/ath11k/core.c:2166 ath11k_core_qmi_firmware_ready()
warn: missing unwind goto?

Quoted 8 lines

---
Changelog:
v2: add smatch warn at commit msg
v1: https://lore.kernel.org/linux-wireless/[email protected]/

---
  drivers/net/wireless/ath/ath11k/core.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Forgot to mention, pls use branch tag (ath-next) in the patch title for automation to pickup this patch.