From 5a9c4a55a76afabefbbc7c0bb2eb1ee8822eebc1 Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Tue, 9 Mar 2021 21:54:21 -0800 Subject: [PATCH] qcacld-3.0: Fix scenario for updating the country When updating the country to be the same value, the function will return failure. This causes a crash in the wifi start up. Add check to see if the country code is the same to avoid calling the API. Change-Id: I7be11857fd9cc87b65f6c598d842a9ed5c024f59 CRs-fixed: 2896855 --- core/hdd/src/wlan_hdd_regulatory.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 0e3e977f2b3f..9903ab9cc411 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -742,6 +742,8 @@ int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code) { QDF_STATUS status; uint8_t cc[REG_ALPHA2_LEN + 1]; + uint8_t alpha2[REG_ALPHA2_LEN + 1]; + enum country_src cc_src; if (!country_code) { hdd_err("country_code is null"); @@ -751,6 +753,14 @@ int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code) qdf_mem_copy(cc, country_code, REG_ALPHA2_LEN); cc[REG_ALPHA2_LEN] = '\0'; + if (!qdf_mem_cmp(country_code, hdd_ctx->reg.alpha2, REG_ALPHA2_LEN)) { + cc_src = ucfg_reg_get_cc_and_src(hdd_ctx->psoc, alpha2); + if (cc_src == SOURCE_USERSPACE || cc_src == SOURCE_CORE) { + hdd_debug("country code is the same"); + return 0; + } + } + qdf_event_reset(&hdd_ctx->regulatory_update_event); qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); hdd_ctx->is_regulatory_update_in_progress = true;