lkml.org 
[lkml]   [2021]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 01/10] PM / devfreq: strengthen check for freq_table
From
Date
On 9/29/21 1:42 PM, Samuel Holland wrote:
> Since commit ea572f816032 ("PM / devfreq: Change return type of
> devfreq_set_freq_table()"), all devfreq devices are expected to have a
> valid freq_table. The devfreq core unconditionally dereferences
> freq_table in the sysfs code and in get_freq_range().
>
> Therefore, we need to ensure that freq_table is both non-null and
> non-empty (length is > 0). If either check fails, replace the table
> using set_freq_table() or return the error.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> drivers/devfreq/devfreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 28f3e0ba6cdd..7a8b022ba456 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -827,7 +827,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
> goto err_dev;
> }
>
> - if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
> + if (!devfreq->profile->max_state || !devfreq->profile->freq_table) {
> mutex_unlock(&devfreq->lock);
> err = set_freq_table(devfreq);
> if (err < 0)
>


Applied it. Thanks.

--
Best Regards,
Chanwoo Choi
Samsung Electronics

\
 
 \ /
  Last update: 2021-09-30 05:37    [W:1.026 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site