Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a9c4a55 authored by Lincoln Tran's avatar Lincoln Tran Committed by snandini
Browse files

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
parent c0d7d8fa
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;