WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][1/2] In cpufreq, check for a driver before use

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH][1/2] In cpufreq, check for a driver before use
From: Mark Langsdorf <mark.langsdorf@xxxxxxx>
Date: Thu, 22 Oct 2009 10:53:36 -0500
Delivery-date: Thu, 22 Oct 2009 08:54:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.10
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 <mark.langsdorf@xxxxxxx>

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;


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][1/2] In cpufreq, check for a driver before use, Mark Langsdorf <=