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

Commit 0723b473 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: msm_perf: prevent cpumask bits to be NULL"

parents 7f2255cc a4ac5340
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -1718,6 +1718,8 @@ static int __ref msm_performance_cpu_callback(struct notifier_block *nfb,
		return NOTIFY_OK;

	for (i = 0; i < num_clusters; i++) {
		if (managed_clusters[i]->cpus == NULL)
			return NOTIFY_OK;
		if (cpumask_test_cpu(cpu, managed_clusters[i]->cpus)) {
			i_cl = managed_clusters[i];
			break;
@@ -1732,6 +1734,8 @@ static int __ref msm_performance_cpu_callback(struct notifier_block *nfb,
		 * Prevent onlining of a managed CPU if max_cpu criteria is
		 * already satisfied
		 */
		if (i_cl->offlined_cpus == NULL)
			return NOTIFY_OK;
		if (i_cl->max_cpu_request <=
					num_online_managed(i_cl->cpus)) {
			pr_debug("msm_perf: Prevent CPU%d onlining\n", cpu);
@@ -1741,6 +1745,8 @@ static int __ref msm_performance_cpu_callback(struct notifier_block *nfb,
		cpumask_clear_cpu(cpu, i_cl->offlined_cpus);

	} else if (action == CPU_DEAD) {
		if (i_cl->offlined_cpus == NULL)
			return NOTIFY_OK;
		if (cpumask_test_cpu(cpu, i_cl->offlined_cpus))
			return NOTIFY_OK;
		/*
@@ -1816,6 +1822,18 @@ static int init_cluster_control(void)
								GFP_KERNEL);
		if (!managed_clusters[i])
			return -ENOMEM;
		if (!alloc_cpumask_var(&managed_clusters[i]->cpus,
		     GFP_KERNEL)) {
			pr_err("msm_perf:Cluster %u cpu alloc failed\n",
			       i);
			return -ENOMEM;
		}
		if (!alloc_cpumask_var(&managed_clusters[i]->offlined_cpus,
		     GFP_KERNEL)) {
			pr_err("msm_perf:Cluster %u off_cpus alloc failed\n",
			       i);
			return -ENOMEM;
		}
		managed_clusters[i]->max_cpu_request = -1;
		managed_clusters[i]->single_enter_load = DEF_SINGLE_ENT;
		managed_clusters[i]->single_exit_load = DEF_SINGLE_EX;