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

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

Merge "cpufreq: Add if cpu is online check in show"

parents 985ce714 2a27b376
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -657,10 +657,15 @@ static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf)
{
	struct cpufreq_policy *policy = to_policy(kobj);
	struct freq_attr *fattr = to_attr(attr);
	ssize_t ret;
	ssize_t ret = -EINVAL;

	get_online_cpus();

	if (!cpu_online(policy->cpu))
		goto unlock;

	if (!down_read_trylock(&cpufreq_rwsem))
		return -EINVAL;
		goto unlock;

	down_read(&policy->rwsem);

@@ -671,7 +676,8 @@ static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf)

	up_read(&policy->rwsem);
	up_read(&cpufreq_rwsem);

unlock:
	put_online_cpus();
	return ret;
}