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] cpufreq.c: shut up compiler about cpufreq_dom

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] cpufreq.c: shut up compiler about cpufreq_dom
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Wed, 29 Oct 2008 16:45:38 +0000
Delivery-date: Wed, 29 Oct 2008 09:46:07 -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
Some versions of GCC are too stupid to figure out that cpufreq_dom is
only used if !!domexist and always set in that case, and complain that
it may be used uninitialised.

(In general it is IMO better to avoid these kind of flag
variables; I would prefer structures like
       for (...) { cpufreq_dom = dom;  if (...) goto cpufreq_dom_found; }
       cpufreq_dom = 0;
     cpufreq_dom_found:
but on the other hand I don't like purely stylistic changes.)

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r ae100f264f6a xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c     Wed Oct 29 13:09:37 2008 +0000
+++ b/xen/drivers/cpufreq/cpufreq.c     Wed Oct 29 16:41:14 2008 +0000
@@ -80,7 +80,7 @@ int cpufreq_add_cpu(unsigned int cpu)
     unsigned int dom, domexist = 0;
     unsigned int j;
     struct list_head *pos;
-    struct cpufreq_dom *cpufreq_dom;
+    struct cpufreq_dom *cpufreq_dom = 0;
     struct cpufreq_policy new_policy;
     struct cpufreq_policy *policy;
     struct processor_performance *perf = &processor_pminfo[cpu]->perf;

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