All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target()
@ 2023-03-29 13:36 Yajun Deng
  2023-03-29 14:21 ` Rafael J. Wysocki
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Yajun Deng @ 2023-03-29 13:36 UTC (permalink / raw)
  To: rafael, viresh.kumar; +Cc: linux-pm, linux-kernel, Yajun Deng

__resolve_freq() may be return target_freq if policy->freq_table is
NULL. In this case, it should return -EINVAL before __target_index().

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 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 c0e5be0fe2d6..308a3df1a940 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2299,7 +2299,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
 		return cpufreq_driver->target(policy, target_freq, relation);
 	}
 
-	if (!cpufreq_driver->target_index)
+	if (!cpufreq_driver->target_index || !policy->freq_table)
 		return -EINVAL;
 
 	return __target_index(policy, policy->cached_resolved_idx);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-04  3:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 13:36 [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target() Yajun Deng
2023-03-29 14:21 ` Rafael J. Wysocki
2023-03-30  1:39 ` Yajun Deng
2023-03-30  3:57   ` Viresh Kumar
2023-03-30 10:10     ` Rafael J. Wysocki
2023-04-03  4:11 ` Viresh Kumar
2023-04-04  3:08 ` Yajun Deng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.