* [PATCH] cpufreq: Fix incorrect usage of clamp_val()
@ 2016-05-31 11:19 Viresh Kumar
2016-05-31 18:23 ` Steve Muckle
2016-05-31 20:44 ` Rafael J. Wysocki
0 siblings, 2 replies; 5+ messages in thread
From: Viresh Kumar @ 2016-05-31 11:19 UTC (permalink / raw)
To: Rafael Wysocki, Viresh Kumar; +Cc: linaro-kernel, linux-pm
clamp_val() doesn't change anything by itself, rather it returns the
clamped value.
Fix it.
Fixes: 0ac587b32f49 ("cpufreq: Use clamp_val() in __cpufreq_driver_target()")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Hi Rafael,
Please merge this with the offending commit if you are fine with rebase,
else apply this one as well.
Sorry for blindly copying code.
drivers/cpufreq/cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d0c02a7eec0f..c6a14ba239a2 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1927,7 +1927,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
return -ENODEV;
/* Make sure that target_freq is within supported range */
- clamp_val(target_freq, policy->min, policy->max);
+ target_freq = clamp_val(target_freq, policy->min, policy->max);
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
policy->cpu, target_freq, relation, old_target_freq);
--
2.7.1.410.g6faf27b
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] cpufreq: Fix incorrect usage of clamp_val() 2016-05-31 11:19 [PATCH] cpufreq: Fix incorrect usage of clamp_val() Viresh Kumar @ 2016-05-31 18:23 ` Steve Muckle 2016-05-31 20:46 ` Rafael J. Wysocki 2016-05-31 20:44 ` Rafael J. Wysocki 1 sibling, 1 reply; 5+ messages in thread From: Steve Muckle @ 2016-05-31 18:23 UTC (permalink / raw) To: Viresh Kumar; +Cc: Rafael Wysocki, linaro-kernel, linux-pm On Tue, May 31, 2016 at 04:49:42PM +0530, Viresh Kumar wrote: > clamp_val() doesn't change anything by itself, rather it returns the > clamped value. > > Fix it. > > Fixes: 0ac587b32f49 ("cpufreq: Use clamp_val() in __cpufreq_driver_target()") > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > Hi Rafael, > > Please merge this with the offending commit if you are fine with rebase, > else apply this one as well. > > Sorry for blindly copying code. > > drivers/cpufreq/cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index d0c02a7eec0f..c6a14ba239a2 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1927,7 +1927,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, > return -ENODEV; > > /* Make sure that target_freq is within supported range */ > - clamp_val(target_freq, policy->min, policy->max); > + target_freq = clamp_val(target_freq, policy->min, policy->max); > > pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", > policy->cpu, target_freq, relation, old_target_freq); As mentioned in the other thread cpufreq_driver_fast_switch() has this problem as well, might as well fix it in this patch also. thanks, Steve ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: Fix incorrect usage of clamp_val() 2016-05-31 18:23 ` Steve Muckle @ 2016-05-31 20:46 ` Rafael J. Wysocki 2016-06-01 1:32 ` Viresh Kumar 0 siblings, 1 reply; 5+ messages in thread From: Rafael J. Wysocki @ 2016-05-31 20:46 UTC (permalink / raw) To: Steve Muckle, Viresh Kumar; +Cc: linaro-kernel, linux-pm On Tuesday, May 31, 2016 11:23:08 AM Steve Muckle wrote: > On Tue, May 31, 2016 at 04:49:42PM +0530, Viresh Kumar wrote: > > clamp_val() doesn't change anything by itself, rather it returns the > > clamped value. > > > > Fix it. > > > > Fixes: 0ac587b32f49 ("cpufreq: Use clamp_val() in __cpufreq_driver_target()") > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > --- > > Hi Rafael, > > > > Please merge this with the offending commit if you are fine with rebase, > > else apply this one as well. > > > > Sorry for blindly copying code. > > > > drivers/cpufreq/cpufreq.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index d0c02a7eec0f..c6a14ba239a2 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -1927,7 +1927,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, > > return -ENODEV; > > > > /* Make sure that target_freq is within supported range */ > > - clamp_val(target_freq, policy->min, policy->max); > > + target_freq = clamp_val(target_freq, policy->min, policy->max); > > > > pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", > > policy->cpu, target_freq, relation, old_target_freq); > > As mentioned in the other thread cpufreq_driver_fast_switch() has this > problem as well, might as well fix it in this patch also. Patch apppended. --- From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Subject: [PATCH] cpufreq: Fix clamp_val() usage in cpufreq_driver_fast_switch() The return value of clamp_val() has to be stored actually. Fixes: b7898fda5bc7 (cpufreq: Support for fast frequency switching) Reported-by: Steve Muckle <steve.muckle@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-pm/drivers/cpufreq/cpufreq.c =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq.c +++ linux-pm/drivers/cpufreq/cpufreq.c @@ -1829,7 +1829,7 @@ EXPORT_SYMBOL(cpufreq_unregister_notifie unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) { - clamp_val(target_freq, policy->min, policy->max); + target_freq = clamp_val(target_freq, policy->min, policy->max); return cpufreq_driver->fast_switch(policy, target_freq); } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: Fix incorrect usage of clamp_val() 2016-05-31 20:46 ` Rafael J. Wysocki @ 2016-06-01 1:32 ` Viresh Kumar 0 siblings, 0 replies; 5+ messages in thread From: Viresh Kumar @ 2016-06-01 1:32 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Steve Muckle, linaro-kernel, linux-pm On 31-05-16, 22:46, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > Subject: [PATCH] cpufreq: Fix clamp_val() usage in cpufreq_driver_fast_switch() > > The return value of clamp_val() has to be stored actually. > > Fixes: b7898fda5bc7 (cpufreq: Support for fast frequency switching) > Reported-by: Steve Muckle <steve.muckle@linaro.org> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > drivers/cpufreq/cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux-pm/drivers/cpufreq/cpufreq.c > =================================================================== > --- linux-pm.orig/drivers/cpufreq/cpufreq.c > +++ linux-pm/drivers/cpufreq/cpufreq.c > @@ -1829,7 +1829,7 @@ EXPORT_SYMBOL(cpufreq_unregister_notifie > unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, > unsigned int target_freq) > { > - clamp_val(target_freq, policy->min, policy->max); > + target_freq = clamp_val(target_freq, policy->min, policy->max); > > return cpufreq_driver->fast_switch(policy, target_freq); > } I should have at least grepped for it during my fix. Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: Fix incorrect usage of clamp_val() 2016-05-31 11:19 [PATCH] cpufreq: Fix incorrect usage of clamp_val() Viresh Kumar 2016-05-31 18:23 ` Steve Muckle @ 2016-05-31 20:44 ` Rafael J. Wysocki 1 sibling, 0 replies; 5+ messages in thread From: Rafael J. Wysocki @ 2016-05-31 20:44 UTC (permalink / raw) To: Viresh Kumar; +Cc: linaro-kernel, linux-pm On Tuesday, May 31, 2016 04:49:42 PM Viresh Kumar wrote: > clamp_val() doesn't change anything by itself, rather it returns the > clamped value. > > Fix it. > > Fixes: 0ac587b32f49 ("cpufreq: Use clamp_val() in __cpufreq_driver_target()") > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > Hi Rafael, > > Please merge this with the offending commit if you are fine with rebase, > else apply this one as well. Done. > Sorry for blindly copying code. Well, I got that wrong myself after all ... Thanks, Rafael ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-01 1:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-31 11:19 [PATCH] cpufreq: Fix incorrect usage of clamp_val() Viresh Kumar 2016-05-31 18:23 ` Steve Muckle 2016-05-31 20:46 ` Rafael J. Wysocki 2016-06-01 1:32 ` Viresh Kumar 2016-05-31 20:44 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox