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

Commit 8cd2f0a3 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

msm: thermal: Initialize per cpu variables during thermal init



Initializing the per cpu variables inside frequency/hotplug
probe function has a possibility that it may result in
uninitialized variables. So initialize the per cpu variables
in the thermal drivers init function.

Change-Id: Id01666d1ddf6de1a1078d6900d8bb86b77adbf56
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 447b3b94
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -2336,6 +2336,18 @@ int msm_thermal_init(struct msm_thermal_data *pdata)
	int ret = 0;
	uint32_t cpu;

	for_each_possible_cpu(cpu) {
		cpus[cpu].cpu = cpu;
		cpus[cpu].offline = 0;
		cpus[cpu].user_offline = 0;
		cpus[cpu].hotplug_thresh_clear = false;
		cpus[cpu].max_freq = false;
		cpus[cpu].user_max_freq = UINT_MAX;
		cpus[cpu].user_min_freq = 0;
		cpus[cpu].limited_max_freq = UINT_MAX;
		cpus[cpu].limited_min_freq = 0;
		cpus[cpu].freq_thresh_clear = false;
	}
	BUG_ON(!pdata);
	memcpy(&msm_thermal_info, pdata, sizeof(struct msm_thermal_data));

@@ -2344,10 +2356,6 @@ int msm_thermal_init(struct msm_thermal_data *pdata)

	enabled = 1;
	polling_enabled = 1;
	for_each_possible_cpu(cpu) {
		cpus[cpu].limited_max_freq = UINT_MAX;
		cpus[cpu].limited_min_freq = 0;
	}
	ret = cpufreq_register_notifier(&msm_thermal_cpufreq_notifier,
			CPUFREQ_POLICY_NOTIFIER);
	if (ret)
@@ -2817,10 +2825,6 @@ static int probe_cc(struct device_node *node, struct msm_thermal_data *data,
	}

	for_each_possible_cpu(cpu) {
		cpus[cpu].cpu = cpu;
		cpus[cpu].offline = 0;
		cpus[cpu].user_offline = 0;
		cpus[cpu].hotplug_thresh_clear = false;
		ret = of_property_read_string_index(node, key, cpu,
				&cpus[cpu].sensor_type);
		if (ret)
@@ -2984,7 +2988,6 @@ static int probe_freq_mitigation(struct device_node *node,
{
	char *key = NULL;
	int ret = 0;
	uint32_t cpu;

	key = "qcom,freq-mitigation-temp";
	ret = of_property_read_u32(node, key, &data->freq_mitig_temp_degc);
@@ -3008,14 +3011,6 @@ static int probe_freq_mitigation(struct device_node *node,
		goto PROBE_FREQ_EXIT;

	freq_mitigation_enabled = 1;
	for_each_possible_cpu(cpu) {
		cpus[cpu].max_freq = false;
		cpus[cpu].user_max_freq = UINT_MAX;
		cpus[cpu].user_min_freq = 0;
		cpus[cpu].limited_max_freq = UINT_MAX;
		cpus[cpu].limited_min_freq = 0;
		cpus[cpu].freq_thresh_clear = false;
	}

PROBE_FREQ_EXIT:
	if (ret) {