qcacmn: Add validation code for wmi handler in dfs module

Add validation code for get_wmi_unified_hdl_from_psoc() return
to avoid null pointer access.

Change-Id: I05a8c135df5197356c77df4997d978c0209b0dfd
CRs-Fixed: 2317012
diff --git a/target_if/dfs/src/target_if_dfs.c b/target_if/dfs/src/target_if_dfs.c
index 41f7ee3..311875b 100644
--- a/target_if/dfs/src/target_if_dfs.c
+++ b/target_if/dfs/src/target_if_dfs.c
@@ -173,8 +173,15 @@
 				struct wlan_objmgr_psoc *psoc)
 {
 	int ret;
+	wmi_unified_t wmi_handle;
 
-	ret = wmi_unified_register_event(get_wmi_unified_hdl_from_psoc(psoc),
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("null wmi_handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	ret = wmi_unified_register_event(wmi_handle,
 					 wmi_dfs_radar_event_id,
 					 target_if_radar_event_handler);
 	if (ret) {
@@ -194,7 +201,15 @@
 
 static bool target_if_dfs_offload(struct wlan_objmgr_psoc *psoc)
 {
-	return wmi_service_enabled(get_wmi_unified_hdl_from_psoc(psoc),
+	wmi_unified_t wmi_handle;
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("null wmi_handle");
+		return false;
+	}
+
+	return wmi_service_enabled(wmi_handle,
 				   wmi_service_dfs_phyerr_offload);
 }