Skip to content

Commit 149fadf

Browse files
committed
Merge tag 'pm+acpi-4.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki: "These are four fixes for bugs in the devfreq and cpufreq subsystems, including two regression fixes (one for a recent regression and one for a problem introduced in 4.2). Specifics: - Two fixes for cpufreq regressions, an acpi-cpufreq driver one introduced during the 4.2 cycle when we started to preserve cpufreq directories for offline CPUs and a general one introduced recently (Srinivas Pandruvada). - Two devfreq fixes, one for a double kfree() in an error code path and one for a confusing sysfs-related failure (Geliang Tang, Tobias Jakobi)" * tag 'pm+acpi-4.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: prevent lockup on reading scaling_available_frequencies cpufreq: acpi_cpufreq: prevent crash on reading freqdomain_cpus PM / devfreq: fix double kfree PM / devfreq: Fix governor_store()
2 parents 71419b7 + 670aee3 commit 149fadf

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
149149
{
150150
struct acpi_cpufreq_data *data = policy->driver_data;
151151

152+
if (unlikely(!data))
153+
return -ENODEV;
154+
152155
return cpufreq_show_cpus(data->freqdomain_cpus, buf);
153156
}
154157

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu)
14361436
* since this is a core component, and is essential for the
14371437
* subsequent light-weight ->init() to succeed.
14381438
*/
1439-
if (cpufreq_driver->exit)
1439+
if (cpufreq_driver->exit) {
14401440
cpufreq_driver->exit(policy);
1441+
policy->freq_table = NULL;
1442+
}
14411443
}
14421444

14431445
/**

drivers/devfreq/devfreq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
492492
if (err) {
493493
put_device(&devfreq->dev);
494494
mutex_unlock(&devfreq->lock);
495-
goto err_dev;
495+
goto err_out;
496496
}
497497

498498
mutex_unlock(&devfreq->lock);
@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
518518
err_init:
519519
list_del(&devfreq->node);
520520
device_unregister(&devfreq->dev);
521-
err_dev:
522521
kfree(devfreq);
523522
err_out:
524523
return ERR_PTR(err);
@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
795794
ret = PTR_ERR(governor);
796795
goto out;
797796
}
798-
if (df->governor == governor)
797+
if (df->governor == governor) {
798+
ret = 0;
799799
goto out;
800+
}
800801

801802
if (df->governor) {
802803
ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);

0 commit comments

Comments
 (0)