From 64ad35d2308678b8ac170e72e4891f2e8ccc8c1b Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Thu, 27 Aug 2020 20:49:17 -0700 Subject: [PATCH] qcacld-3.0: Add a null check when enabling qmi stats get_wmi_unified_hdl_from_psoc() is called to get wmi handle from psoc, but it may return null. Thus, add a null check before setting qmi stats. Change-Id: Id9ef8f450ebcbbd2f8d8b078adb0a78ac638efb6 CRs-Fixed: 2764885 --- core/hdd/src/wlan_hdd_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 870eeec3d0c1..f5dfc1ee3695 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3775,8 +3775,14 @@ out: static inline void hdd_set_qmi_stats_enabled(struct hdd_context *hdd_ctx) { - wmi_set_qmi_stats(get_wmi_unified_hdl_from_psoc(hdd_ctx->psoc), - hdd_ctx->config->is_qmi_stats_enabled); + wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(hdd_ctx->psoc); + + if (!wmi_handle) { + hdd_err("could not get wmi handle"); + return; + } + + wmi_set_qmi_stats(wmi_handle, hdd_ctx->config->is_qmi_stats_enabled); } #else static inline