diff mbox series

[1/2] wifi: ath12k: initialize 'ret' in ath12k_qmi_load_file_target_mem()

Message ID 20240504-qmi_load_file_target_mem-v1-1-069fc44c45eb@quicinc.com (mailing list archive)
State Accepted
Commit bb0b0a6b96e6de854cb1e349e17bd0e8bf421a59
Delegated to: Kalle Valo
Headers show
Series wifi: ath1*k: initialize 'ret' in ath1*k_qmi_load_file_target_mem() | expand

Commit Message

Jeff Johnson May 4, 2024, 6:52 p.m. UTC
smatch flagged the following issue:

drivers/net/wireless/ath/ath12k/qmi.c:2619 ath12k_qmi_load_file_target_mem() error: uninitialized symbol 'ret'.

The reality is that 'ret' is initialized in every path through
ath12k_qmi_load_file_target_mem() except one, the case where the input
'len' is 0, and hence the "while (remaining)" loop is never entered.
But to make sure this case is also handled, add an initializer to the
declaration of 'ret'.

No functional changes, compile tested only.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo May 13, 2024, 2:12 p.m. UTC | #1
Jeff Johnson <quic_jjohnson@quicinc.com> wrote:

> smatch flagged the following issue:
> 
> drivers/net/wireless/ath/ath12k/qmi.c:2619 ath12k_qmi_load_file_target_mem() error: uninitialized symbol 'ret'.
> 
> The reality is that 'ret' is initialized in every path through
> ath12k_qmi_load_file_target_mem() except one, the case where the input
> 'len' is 0, and hence the "while (remaining)" loop is never entered.
> But to make sure this case is also handled, add an initializer to the
> declaration of 'ret'.
> 
> No functional changes, compile tested only.
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

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

bb0b0a6b96e6 wifi: ath12k: initialize 'ret' in ath12k_qmi_load_file_target_mem()
199f149e97dc wifi: ath11k: initialize 'ret' in ath11k_qmi_load_file_target_mem()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 3bb730326a02..f273cb93dedb 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2538,7 +2538,7 @@  static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
 	struct qmi_wlanfw_bdf_download_resp_msg_v01 resp = {};
 	struct qmi_txn txn;
 	const u8 *temp = data;
-	int ret;
+	int ret = 0;
 	u32 remaining = len;
 
 	req = kzalloc(sizeof(*req), GFP_KERNEL);