In cpufreq, check for a driver before use
PATCH 1/2 In cpufreq, check for a driver before use
The current cpufreq driver code assumes that a driver was registered before cpufreq_add_cpu() is called. If the driver was not registered or failed registration, cpufreq_add_cpu() crashes.
Test to make sure that cpufreq_driver isn't NULL.
Signed-off-by Mark Langsdorf <[email protected]>
xen/drivers/cpufreq/cpufreq.c +3 -0
@@ -142,6 +142,9 @@ !(perf->init &XEN_PX_INIT ) || !cpu_online(cpu)) return -EINVAL; + +if (!cpufreq_driver) +return 0 ;if (cpufreq_cpu_policy[cpu])return 0 ;