diff options
author | Srinivas Dasari <dasaris@codeaurora.org> | 2017-02-07 17:00:28 +0530 |
---|---|---|
committer | Brinly Taylor <brinly@brinly.me> | 2017-08-17 09:22:34 +1000 |
commit | eabd5a6d3d81a9df679bdcdc934058f421182197 (patch) | |
tree | 38c9ca7910cd93b3ca0491d0d36f434efb8a7e5d | |
parent | b6b2caef1d920328902481cca17f7723e1813cdc (diff) | |
download | android_hardware_qcom_wlan-eabd5a6d3d81a9df679bdcdc934058f421182197.tar.gz android_hardware_qcom_wlan-eabd5a6d3d81a9df679bdcdc934058f421182197.tar.bz2 android_hardware_qcom_wlan-eabd5a6d3d81a9df679bdcdc934058f421182197.zip |
Wifi-HAL: Move llstats freeing to a common API
Link layer stats are getting freed at multiple places. Better
to have a common API and call it.
Change-Id: I06aa330fc955d7266c9e83e4d7abca6098338cd5
CRs-Fixed: 2003354
-rw-r--r-- | qcwcn/wifi_hal/llstats.cpp | 29 | ||||
-rw-r--r-- | qcwcn/wifi_hal/llstatscommand.h | 2 |
2 files changed, 11 insertions, 20 deletions
diff --git a/qcwcn/wifi_hal/llstats.cpp b/qcwcn/wifi_hal/llstats.cpp index e940ca2..17492d5 100644 --- a/qcwcn/wifi_hal/llstats.cpp +++ b/qcwcn/wifi_hal/llstats.cpp @@ -871,6 +871,14 @@ wifi_error LLStatsCommand::notifyResponse() ret = WIFI_ERROR_INVALID_ARGS; } + clearStats(); + + return ret; +} + + +void LLStatsCommand::clearStats() +{ if(mResultsParams.radio_stat) { if (mResultsParams.radio_stat->tx_time_per_levels) @@ -888,8 +896,6 @@ wifi_error LLStatsCommand::notifyResponse() free(mResultsParams.iface_stat); mResultsParams.iface_stat = NULL; } - - return ret; } @@ -1234,24 +1240,7 @@ int LLStatsCommand::handleResponse(WifiEvent &reply) return NL_SKIP; cleanup: - if(mResultsParams.radio_stat) - { - if (mResultsParams.radio_stat->tx_time_per_levels) - { - free(mResultsParams.radio_stat->tx_time_per_levels); - mResultsParams.radio_stat->tx_time_per_levels = NULL; - } - free(mResultsParams.radio_stat); - mResultsParams.radio_stat = NULL; - mRadioStatsSize = 0; - mNumRadios = 0; - } - - if(mResultsParams.iface_stat) - { - free(mResultsParams.iface_stat); - mResultsParams.iface_stat = NULL; - } + clearStats(); return status; } diff --git a/qcwcn/wifi_hal/llstatscommand.h b/qcwcn/wifi_hal/llstatscommand.h index 69f2c3a..63a2f77 100644 --- a/qcwcn/wifi_hal/llstatscommand.h +++ b/qcwcn/wifi_hal/llstatscommand.h @@ -113,6 +113,8 @@ public: struct nlattr **tb_vendor); virtual void setHandler(wifi_stats_result_handler handler); + + virtual void clearStats(); }; #ifdef __cplusplus |