qcacmn: Add null check for legacy callback functions in policy manager

Add null check for callback functions registered from legacy modules
with policy manager.

Change-Id: I8a08870ea904f4e01a17f6a472bdd609df9c3c4c
CRs-Fixed: 2009818
This commit is contained in:
Tushnim Bhattacharyya
2017-03-28 10:45:08 -07:00
committed by Sandeep Puligilla
parent 564d355833
commit ac2819788b
2 changed files with 43 additions and 27 deletions

View File

@@ -260,14 +260,19 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
vdev_id); vdev_id);
return status; return status;
} }
if (pm_ctx->wma_cbacks.wma_get_connection_info) {
status = pm_ctx->wma_cbacks.wma_get_connection_info( status = pm_ctx->wma_cbacks.wma_get_connection_info(
vdev_id, &conn_table_entry); vdev_id, &conn_table_entry);
if (QDF_STATUS_SUCCESS != status) { if (QDF_STATUS_SUCCESS != status) {
policy_mgr_err("can't find vdev_id %d in connection table", policy_mgr_err("can't find vdev_id %d in connection table",
vdev_id); vdev_id);
return status; return status;
}
} else {
policy_mgr_err("wma_get_connection_info is NULL");
return QDF_STATUS_E_FAILURE;
} }
mode = policy_mgr_get_mode(conn_table_entry.type, mode = policy_mgr_get_mode(conn_table_entry.type,
conn_table_entry.sub_type); conn_table_entry.sub_type);
chan = reg_freq_to_chan(conn_table_entry.mhz); chan = reg_freq_to_chan(conn_table_entry.mhz);

View File

@@ -523,17 +523,19 @@ bool policy_mgr_is_hw_dbs_capable(struct wlan_objmgr_psoc *psoc)
policy_mgr_notice("DBS is disabled"); policy_mgr_notice("DBS is disabled");
return false; return false;
} }
if (pm_ctx->wma_cbacks.wma_is_service_enabled) {
policy_mgr_notice("DBS service bit map: %d",
pm_ctx->wma_cbacks.wma_is_service_enabled(
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT));
policy_mgr_notice("DBS service bit map: %d", /* The agreement with FW is that: To know if the target is DBS
pm_ctx->wma_cbacks.wma_is_service_enabled( * capable, DBS needs to be supported both in the HW mode list
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT)); * and in the service ready event
*/
/* The agreement with FW is that: To know if the target is DBS if (!(pm_ctx->wma_cbacks.wma_is_service_enabled(
* capable, DBS needs to be supported both in the HW mode list
* and in the service ready event
*/
if (!(pm_ctx->wma_cbacks.wma_is_service_enabled(
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT))) WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT)))
return false;
} else
return false; return false;
for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) { for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
@@ -562,16 +564,20 @@ bool policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc)
policy_mgr_err("Invalid Context"); policy_mgr_err("Invalid Context");
return false; return false;
} }
if (pm_ctx->wma_cbacks.wma_is_service_enabled) {
policy_mgr_notice("DBS service bit map: %d",
pm_ctx->wma_cbacks.wma_is_service_enabled(
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT));
/* The agreement with FW is that: To know if the target is SBS /* The agreement with FW is that: To know if the target is SBS
* capable, SBS needs to be supported both in the HW mode list * capable, SBS needs to be supported both in the HW mode list
* and DBS needs to be supported in the service ready event * and DBS needs to be supported in the service ready event
*/ */
if (!(pm_ctx->wma_cbacks.wma_is_service_enabled( if (!(pm_ctx->wma_cbacks.wma_is_service_enabled(
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT))) { WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT)))
policy_mgr_err("SBS cannot be supported since DBS is disabled"); return false;
} else
return false; return false;
}
for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) { for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
param = pm_ctx->hw_mode.hw_mode_list[i]; param = pm_ctx->hw_mode.hw_mode_list[i];
@@ -1178,14 +1184,19 @@ QDF_STATUS policy_mgr_incr_connection_count(
pm_ctx->user_cfg.max_concurrent_active_sessions); pm_ctx->user_cfg.max_concurrent_active_sessions);
return status; return status;
} }
if (pm_ctx->wma_cbacks.wma_get_connection_info) {
status = pm_ctx->wma_cbacks.wma_get_connection_info( status = pm_ctx->wma_cbacks.wma_get_connection_info(
vdev_id, &conn_table_entry); vdev_id, &conn_table_entry);
if (QDF_STATUS_SUCCESS != status) { if (QDF_STATUS_SUCCESS != status) {
policy_mgr_err("can't find vdev_id %d in connection table", policy_mgr_err("can't find vdev_id %d in connection table",
vdev_id); vdev_id);
return status; return status;
}
} else {
policy_mgr_err("wma_get_connection_info is NULL");
return QDF_STATUS_E_FAILURE;
} }
mode = policy_mgr_get_mode(conn_table_entry.type, mode = policy_mgr_get_mode(conn_table_entry.type,
conn_table_entry.sub_type); conn_table_entry.sub_type);
chan = reg_freq_to_chan(conn_table_entry.mhz); chan = reg_freq_to_chan(conn_table_entry.mhz);