Skip to content

Commit b0d226a

Browse files
losgobbiJeff Johnson
authored andcommitted
wifi: ath11k: validate ath11k_crypto_mode on top of ath11k_core_qmi_firmware_ready
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. Do the validation as soon as possible in order to avoid undoing actions in that case and also to fix the following smatch warning: drivers/net/wireless/ath/ath11k/core.c:2166 ath11k_core_qmi_firmware_ready() warn: missing unwind goto? Signed-off-by: Rodrigo Gobbi <[email protected]> Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Fixes: aa2092a ("ath11k: add raw mode and software crypto support") Reviewed-by: Baochen Qiang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent 29e2adf commit b0d226a

File tree

1 file changed

+14
-14
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+14
-14
lines changed

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,20 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
21352135
{
21362136
int ret;
21372137

2138+
switch (ath11k_crypto_mode) {
2139+
case ATH11K_CRYPT_MODE_SW:
2140+
set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
2141+
set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
2142+
break;
2143+
case ATH11K_CRYPT_MODE_HW:
2144+
clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
2145+
clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
2146+
break;
2147+
default:
2148+
ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
2149+
return -EINVAL;
2150+
}
2151+
21382152
ret = ath11k_core_start_firmware(ab, ab->fw_mode);
21392153
if (ret) {
21402154
ath11k_err(ab, "failed to start firmware: %d\n", ret);
@@ -2153,20 +2167,6 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
21532167
goto err_firmware_stop;
21542168
}
21552169

2156-
switch (ath11k_crypto_mode) {
2157-
case ATH11K_CRYPT_MODE_SW:
2158-
set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
2159-
set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
2160-
break;
2161-
case ATH11K_CRYPT_MODE_HW:
2162-
clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
2163-
clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
2164-
break;
2165-
default:
2166-
ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
2167-
return -EINVAL;
2168-
}
2169-
21702170
if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
21712171
set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
21722172

0 commit comments

Comments
 (0)