From a3e85cc8b289f77a3fe142eb8871b4de718f4914 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Tue, 8 Sep 2020 12:55:41 -0700 Subject: [PATCH] qcacld-3.0: Move HIF RTPM put before validate context check in cfg80211 resume If FW asserts before cfg80211 resume, cfg80211 resume will skip calling RTPM put, which finally results a usage count mismatch. To fix it move RTPM put call at the beginning of cfg80211 resume to make sure its always called and RTPM usage count is in sync. Change-Id: If0c9fbe094de16d103cd58ed4db3b08b76adb3cf CRs-Fixed: 2728742 --- core/hdd/src/wlan_hdd_power.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index c54eb118fb2f..ed45963c109b 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1896,6 +1896,10 @@ static int _wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) struct hdd_context *hdd_ctx = wiphy_priv(wiphy); int errno; + hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + if (hif_ctx) + hif_pm_runtime_put(hif_ctx, RTPM_ID_SUSPEND_RESUME); + if (!hdd_ctx) { hdd_err_rl("hdd context is null"); return -ENODEV; @@ -1911,12 +1915,8 @@ static int _wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) if (errno) return errno; - hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (!hif_ctx) - return -EINVAL; errno = __wlan_hdd_cfg80211_resume_wlan(wiphy); - hif_pm_runtime_put(hif_ctx, RTPM_ID_SUSPEND_RESUME); return errno; }