Commit 149fadf2 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 71419b7b 670aee3f
...@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) ...@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
{ {
struct acpi_cpufreq_data *data = policy->driver_data; struct acpi_cpufreq_data *data = policy->driver_data;
if (unlikely(!data))
return -ENODEV;
return cpufreq_show_cpus(data->freqdomain_cpus, buf); return cpufreq_show_cpus(data->freqdomain_cpus, buf);
} }
......
...@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu) ...@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu)
* since this is a core component, and is essential for the * since this is a core component, and is essential for the
* subsequent light-weight ->init() to succeed. * subsequent light-weight ->init() to succeed.
*/ */
if (cpufreq_driver->exit) if (cpufreq_driver->exit) {
cpufreq_driver->exit(policy); cpufreq_driver->exit(policy);
policy->freq_table = NULL;
}
} }
/** /**
......
...@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
if (err) { if (err) {
put_device(&devfreq->dev); put_device(&devfreq->dev);
mutex_unlock(&devfreq->lock); mutex_unlock(&devfreq->lock);
goto err_dev; goto err_out;
} }
mutex_unlock(&devfreq->lock); mutex_unlock(&devfreq->lock);
...@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
err_init: err_init:
list_del(&devfreq->node); list_del(&devfreq->node);
device_unregister(&devfreq->dev); device_unregister(&devfreq->dev);
err_dev:
kfree(devfreq); kfree(devfreq);
err_out: err_out:
return ERR_PTR(err); return ERR_PTR(err);
...@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr, ...@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
ret = PTR_ERR(governor); ret = PTR_ERR(governor);
goto out; goto out;
} }
if (df->governor == governor) if (df->governor == governor) {
ret = 0;
goto out; goto out;
}
if (df->governor) { if (df->governor) {
ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL); ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment