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

Commit 93906db1 authored by Vijay Dandiga's avatar Vijay Dandiga
Browse files

msm_perf: check cpu_possible to improve stability



check cpu_possible to improve stability

Change-Id: I9ce3b5a5a6b1e846f44ffb9e255cc5b6b701b377
Signed-off-by: default avatarGaurav Singh <quic_sgaurav@quicinc.com>
Signed-off-by: default avatarVijay Dandiga <quic_vdandiga@quicinc.com>
parent 367074bf
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -76,13 +76,15 @@ static int set_cpu_min_freq(const char *buf, const struct kernel_param *kp)
	for (i = 0; i < ntokens; i += 2) {
		if (sscanf(cp, "%u:%u", &cpu, &val) != 2)
			return -EINVAL;
		if (cpu > (num_present_cpus() - 1))
			return -EINVAL;
		if (cpu >= nr_cpu_ids)
			break;

		if (cpu_possible(cpu)) {
			i_cpu_stats = &per_cpu(msm_perf_cpu_stats, cpu);

			i_cpu_stats->min = val;
			cpumask_set_cpu(cpu, limit_mask);
		}

		cp = strnchr(cp, strlen(cp), ' ');
		cp++;
@@ -153,14 +155,15 @@ static int set_cpu_max_freq(const char *buf, const struct kernel_param *kp)
	for (i = 0; i < ntokens; i += 2) {
		if (sscanf(cp, "%u:%u", &cpu, &val) != 2)
			return -EINVAL;
		if (cpu > (num_present_cpus() - 1))
			return -EINVAL;
		if (cpu >= nr_cpu_ids)
			break;

		if (cpu_possible(cpu)) {
			i_cpu_stats = &per_cpu(msm_perf_cpu_stats, cpu);

			i_cpu_stats->max = val;
			cpumask_set_cpu(cpu, limit_mask);

		}
		cp = strnchr(cp, strlen(cp), ' ');
		cp++;
	}