[PATCH] ath11k: do not return random value

Michael Straube straube.linux at gmail.com
Mon Apr 4 03:53:24 PDT 2022


Function ath11k_qmi_assign_target_mem_chunk() returns a random value
if of_parse_phandle() fails because the return variable ret is not
initialized before calling of_parse_phandle(). Return -EINVAL to avoid
possibly returning 0, which would be wrong here.

Issue found by smatch.

Signed-off-by: Michael Straube <straube.linux at gmail.com>
---
 drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 65d3c6ba35ae..81b2304b1fde 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
 			if (!hremote_node) {
 				ath11k_dbg(ab, ATH11K_DBG_QMI,
 					   "qmi fail to get hremote_node\n");
-				return ret;
+				return -EINVAL;
 			}
 
 			ret = of_address_to_resource(hremote_node, 0, &res);
-- 
2.35.1




More information about the ath11k mailing list