* [PATCH] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning
@ 2022-09-21 7:10 Viresh Kumar
2022-09-21 7:14 ` Neil Armstrong
0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2022-09-21 7:10 UTC (permalink / raw)
To: Rafael J. Wysocki, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Dmitry Baryshkov, Vladimir Zapolskiy
Cc: linux-pm, Vincent Guittot, v5 . 18+, kernel test robot,
Dan Carpenter, linux-arm-msm, linux-kernel
Commit 6240aaad75e1 was supposed to drop the reference count to the OPP,
instead it avoided more stuff if the OPP isn't found. This isn't
entirely correct. We already have a frequency value available, we just
couldn't align it with an OPP in case of IS_ERR(opp).
Lets continue with updating thermal pressure, etc, even if we aren't
able to find an OPP here.
This fixes warning generated by the 'smatch' tool.
Fixes: 6240aaad75e1 ("cpufreq: qcom-hw: fix the opp entries refcounting")
Cc: v5.18+ <stable@vger.kernel.org> # v5.18+
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index d5ef3c66c762..bb32659820ce 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -316,14 +316,14 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
if (IS_ERR(opp)) {
dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp);
} else {
- throttled_freq = freq_hz / HZ_PER_KHZ;
-
- /* Update thermal pressure (the boost frequencies are accepted) */
- arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
-
dev_pm_opp_put(opp);
}
+ throttled_freq = freq_hz / HZ_PER_KHZ;
+
+ /* Update thermal pressure (the boost frequencies are accepted) */
+ arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
+
/*
* In the unlikely case policy is unregistered do not enable
* polling or h/w interrupt
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning
2022-09-21 7:10 [PATCH] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning Viresh Kumar
@ 2022-09-21 7:14 ` Neil Armstrong
0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2022-09-21 7:14 UTC (permalink / raw)
To: Viresh Kumar, Rafael J. Wysocki, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Dmitry Baryshkov, Vladimir Zapolskiy
Cc: linux-pm, Vincent Guittot, v5 . 18+, kernel test robot,
Dan Carpenter, linux-arm-msm, linux-kernel
On 21/09/2022 09:10, Viresh Kumar wrote:
> Commit 6240aaad75e1 was supposed to drop the reference count to the OPP,
> instead it avoided more stuff if the OPP isn't found. This isn't
> entirely correct. We already have a frequency value available, we just
> couldn't align it with an OPP in case of IS_ERR(opp).
>
> Lets continue with updating thermal pressure, etc, even if we aren't
> able to find an OPP here.
>
> This fixes warning generated by the 'smatch' tool.
>
> Fixes: 6240aaad75e1 ("cpufreq: qcom-hw: fix the opp entries refcounting")
> Cc: v5.18+ <stable@vger.kernel.org> # v5.18+
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index d5ef3c66c762..bb32659820ce 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -316,14 +316,14 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
> if (IS_ERR(opp)) {
> dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp);
> } else {
> - throttled_freq = freq_hz / HZ_PER_KHZ;
> -
> - /* Update thermal pressure (the boost frequencies are accepted) */
> - arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
> -
> dev_pm_opp_put(opp);
> }
>
> + throttled_freq = freq_hz / HZ_PER_KHZ;
> +
> + /* Update thermal pressure (the boost frequencies are accepted) */
> + arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
> +
> /*
> * In the unlikely case policy is unregistered do not enable
> * polling or h/w interrupt
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-21 7:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21 7:10 [PATCH] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning Viresh Kumar
2022-09-21 7:14 ` Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox