Commit 3522b35c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-4.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "Fix for a latent cpufreq driver bug uncovered by a recent ACPICA
  change and several fixes for the devfreq framework, including one fix
  for an issue introduced recently.

  Specifics:

   - Fix a latent initialization issue in the pcc-cpufreq driver
     (incorrect initial value of a structure field) that has been
     uncovered by a recent ACPICA commit (Mike Galbraith).

   - Add a missing notification in an update_devfreq() error code path
     forgotten by a recent devfreq commit (Chanwoo Choi).

   - Fix devfreq device frequency initialization (Lukasz Luba).

   - Fix an incorrect IS_ERR() check in the devfreq framework discovered
     by the Smatch checker (Dan Carpenter).

   - Drop two excessive put_device() calls from the devfreq framework
     (MyungJoo Ham, Cai Zhiyong).

   - Fix a possible memory leak in the devfreq framework and drop an
     unnecessary kfree() invocation from it (MyungJoo Ham)"

* tag 'pm-4.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / devfreq: Send the DEVFREQ_POSTCHANGE notification when target() is failed
  cpufreq: pcc-cpufreq: Fix doorbell.access_width
  PM / devfreq: fix initialization of current frequency in last status
  PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
  PM / devfreq: remove double put_device
  PM / devfreq: fix double call put_device
  PM / devfreq: fix duplicated kfree on devfreq pointer
  PM / devfreq: devm_kzalloc to have dev pointer more precisely
parents 032fd3e5 e753f305
...@@ -487,7 +487,7 @@ static int __init pcc_cpufreq_probe(void) ...@@ -487,7 +487,7 @@ static int __init pcc_cpufreq_probe(void)
doorbell.space_id = reg_resource->space_id; doorbell.space_id = reg_resource->space_id;
doorbell.bit_width = reg_resource->bit_width; doorbell.bit_width = reg_resource->bit_width;
doorbell.bit_offset = reg_resource->bit_offset; doorbell.bit_offset = reg_resource->bit_offset;
doorbell.access_width = 64; doorbell.access_width = 4;
doorbell.address = reg_resource->address; doorbell.address = reg_resource->address;
pr_debug("probe: doorbell: space_id is %d, bit_width is %d, " pr_debug("probe: doorbell: space_id is %d, bit_width is %d, "
......
...@@ -268,8 +268,11 @@ int update_devfreq(struct devfreq *devfreq) ...@@ -268,8 +268,11 @@ int update_devfreq(struct devfreq *devfreq)
devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE); devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE);
err = devfreq->profile->target(devfreq->dev.parent, &freq, flags); err = devfreq->profile->target(devfreq->dev.parent, &freq, flags);
if (err) if (err) {
freqs.new = cur_freq;
devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
return err; return err;
}
freqs.new = freq; freqs.new = freq;
devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE); devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
...@@ -552,6 +555,7 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -552,6 +555,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->profile = profile; devfreq->profile = profile;
strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN);
devfreq->previous_freq = profile->initial_freq; devfreq->previous_freq = profile->initial_freq;
devfreq->last_status.current_frequency = profile->initial_freq;
devfreq->data = data; devfreq->data = data;
devfreq->nb.notifier_call = devfreq_notifier_call; devfreq->nb.notifier_call = devfreq_notifier_call;
...@@ -561,23 +565,22 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -561,23 +565,22 @@ struct devfreq *devfreq_add_device(struct device *dev,
mutex_lock(&devfreq->lock); mutex_lock(&devfreq->lock);
} }
devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) *
devfreq->profile->max_state *
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned long) *
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->last_stat_updated = jiffies;
dev_set_name(&devfreq->dev, "%s", dev_name(dev)); dev_set_name(&devfreq->dev, "%s", dev_name(dev));
err = device_register(&devfreq->dev); err = device_register(&devfreq->dev);
if (err) { if (err) {
put_device(&devfreq->dev);
mutex_unlock(&devfreq->lock); mutex_unlock(&devfreq->lock);
goto err_out; goto err_out;
} }
devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
devfreq->profile->max_state *
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->last_stat_updated = jiffies;
srcu_init_notifier_head(&devfreq->transition_notifier_list); srcu_init_notifier_head(&devfreq->transition_notifier_list);
mutex_unlock(&devfreq->lock); mutex_unlock(&devfreq->lock);
...@@ -603,7 +606,6 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -603,7 +606,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);
kfree(devfreq);
err_out: err_out:
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -621,7 +623,6 @@ int devfreq_remove_device(struct devfreq *devfreq) ...@@ -621,7 +623,6 @@ int devfreq_remove_device(struct devfreq *devfreq)
return -EINVAL; return -EINVAL;
device_unregister(&devfreq->dev); device_unregister(&devfreq->dev);
put_device(&devfreq->dev);
return 0; return 0;
} }
......
...@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev, ...@@ -220,9 +220,6 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,
/* Maps the memory mapped IO to control nocp register */ /* Maps the memory mapped IO to control nocp register */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (IS_ERR(res))
return PTR_ERR(res);
base = devm_ioremap_resource(dev, res); base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
......
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