From 620b388c2aa33b19a7b5ad07f408a6dceb359f99 Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Thu, 2 Mar 2017 11:47:47 -0800 Subject: qcacld-3.0: Do range check only if ini value is set from the file For some of the configurations, the default is not one of the in-range values because we want to detect if the value has been set or not. Hence, do the range check when a value is present in the cfg.ini. Change-Id: I4db722ed5053e2248dc23c7417d192fe6093ee46 CRs-Fixed: 2014145 --- core/hdd/src/wlan_hdd_cfg.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 3a47656101e9..7cd40d59abc4 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4858,8 +4858,9 @@ static QDF_STATUS hdd_apply_cfg_ini(hdd_context_t *pHddCtx, value = pRegEntry->VarDefault; } - /* If this parameter needs range checking, do it here. */ - if (pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK) { + /* Only if the parameter is set in the ini file, do the range check here */ + if (match_status == QDF_STATUS_SUCCESS && + pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK) { if (value > pRegEntry->VarMax) { hdd_warn("Reg Parameter %s > allowed Maximum [%u > %lu]. Enforcing Maximum", pRegEntry->RegName, value, pRegEntry->VarMax); @@ -4872,9 +4873,10 @@ static QDF_STATUS hdd_apply_cfg_ini(hdd_context_t *pHddCtx, value = pRegEntry->VarMin; } } - /* If this parameter needs range checking, do it here. */ - else if (pRegEntry-> - Flags & VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT) { + /* Only if the parameter is set in the ini file, do the range check here */ + else if (match_status == QDF_STATUS_SUCCESS && + pRegEntry->Flags & + VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT) { if (value > pRegEntry->VarMax) { hdd_warn("Reg Parameter %s > allowed Maximum [%u > %lu]. Enforcing Default: %lu", pRegEntry->RegName, value, pRegEntry->VarMax, @@ -4906,8 +4908,9 @@ static QDF_STATUS hdd_apply_cfg_ini(hdd_context_t *pHddCtx, svalue = (int32_t) pRegEntry->VarDefault; } - /* If this parameter needs range checking, do it here. */ - if (pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK) { + /* Only if the parameter is set in the ini file, do the range check here */ + if (match_status == QDF_STATUS_SUCCESS && + pRegEntry->Flags & VAR_FLAGS_RANGE_CHECK) { if (svalue > (int32_t) pRegEntry->VarMax) { hdd_warn("Reg Parameter %s > allowed Maximum " "[%d > %d]. Enforcing Maximum", pRegEntry->RegName, @@ -4922,9 +4925,10 @@ static QDF_STATUS hdd_apply_cfg_ini(hdd_context_t *pHddCtx, svalue = (int32_t) pRegEntry->VarMin; } } - /* If this parameter needs range checking, do it here. */ - else if (pRegEntry-> - Flags & VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT) { + /* Only if the parameter is set in the ini file, do the range check here */ + else if (match_status == QDF_STATUS_SUCCESS && + pRegEntry->Flags & + VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT) { if (svalue > (int32_t) pRegEntry->VarMax) { hdd_warn("Reg Parameter %s > allowed Maximum " "[%d > %d]. Enforcing Default: %d", pRegEntry->RegName, -- cgit v1.2.3