From b94338a8d7dac4256818d0f5e06830f2a89d18c6 Mon Sep 17 00:00:00 2001 From: Vikram Kandukuri Date: Fri, 15 May 2020 00:44:36 +0530 Subject: [PATCH] qcacmn: Add null pointer check Add null pointer check for wmi handle in CFR functions. CRs-Fixed: 2673593 Change-Id: I0993f36749f856df8849913f0338a8dc2581fa95 --- target_if/cfr/src/target_if_cfr.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/target_if/cfr/src/target_if_cfr.c b/target_if/cfr/src/target_if_cfr.c index 9cdd420762d6..7d0e31d52295 100644 --- a/target_if/cfr/src/target_if_cfr.c +++ b/target_if/cfr/src/target_if_cfr.c @@ -49,6 +49,10 @@ int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev, return -EINVAL; pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); + if (!pdev_wmi_handle) { + cfr_err("pdev wmi handle NULL"); + return -EINVAL; + } vdev = wlan_peer_get_vdev(peer); qdf_mem_set(¶m, sizeof(param), 0); @@ -92,6 +96,10 @@ int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev, int retv = 0; pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); + if (!pdev_wmi_handle) { + cfr_err("pdev wmi handle NULL"); + return -EINVAL; + } vdev = wlan_peer_get_vdev(peer); qdf_mem_set(¶m, sizeof(param), 0); @@ -112,16 +120,22 @@ int target_if_cfr_pdev_set_param(struct wlan_objmgr_pdev *pdev, { struct pdev_params pparam; uint32_t pdev_id; + struct wmi_unified *pdev_wmi_handle = NULL; pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); if (pdev_id < 0) return -EINVAL; + pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); + if (!pdev_wmi_handle) { + cfr_err("pdev wmi handle NULL"); + return -EINVAL; + } qdf_mem_set(&pparam, sizeof(pparam), 0); pparam.param_id = param_id; pparam.param_value = param_value; - return wmi_unified_pdev_param_send(lmac_get_pdev_wmi_handle(pdev), + return wmi_unified_pdev_param_send(pdev_wmi_handle, &pparam, pdev_id); }