diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3d7a0b9611f9..2ba4595eb1d6 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -3385,4 +3385,15 @@ mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter) hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL; } +/** + * hdd_handle_to_context() - turn an HDD handle into an HDD context + * @hdd_handle: HDD handle to be converted + * + * Return: HDD context referenced by @hdd_handle + */ +static inline +struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle) +{ + return (struct hdd_context *)hdd_handle; +} #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 7111a7c396c2..076f20537b26 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1907,7 +1907,7 @@ static void hdd_update_ra_rate_limit(struct hdd_context *hdd_ctx, void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) { int ret; - struct hdd_context *hdd_ctx = (struct hdd_context *)hdd_handle; + struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle); uint8_t temp_band_cap; struct cds_config_info *cds_cfg = cds_get_ini_config(); uint8_t antenna_mode; diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 14c0e53b42c7..228b4fd5d40a 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -2296,17 +2296,12 @@ void wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx, hdd_enter(); - if (!ctx) { - hdd_err("Invalid HDD context."); - return; - } - if (!rsp) { hdd_err("Invalid result."); return; } - hdd_ctx = (struct hdd_context *)ctx; + hdd_ctx = hdd_handle_to_context(ctx); linkLayer_stats_results = rsp; status = wlan_hdd_validate_context(hdd_ctx);