From: Mark Langsdorf Subject: [PATCH][1/2] In cpufreq, check for a driver before use Date: Thu, 22 Oct 2009 10:53:36 -0500 Message-ID: <200910221053.36722.mark.langsdorf@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 diff -r d7d7f978d704 xen/drivers/cpufreq/cpufreq.c --- a/xen/drivers/cpufreq/cpufreq.c Tue Oct 20 14:36:01 2009 +0100 +++ b/xen/drivers/cpufreq/cpufreq.c Wed Oct 21 15:08:27 2009 -0500 @@ -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;