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

RE: [Xen-devel] [PATCH] cpufreq.c: shut up compiler about cpufreq_dom

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] cpufreq.c: shut up compiler about cpufreq_dom
From: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>
Date: Thu, 30 Oct 2008 15:13:12 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Thu, 30 Oct 2008 00:13:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <18696.37682.162183.607991@xxxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <18696.37682.162183.607991@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ack55eJda//E+YPLTJ6/oQF4M6GBUgAeNYSg
Thread-topic: [Xen-devel] [PATCH] cpufreq.c: shut up compiler about cpufreq_dom
Ian Jackson wrote:
> 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.)

Ian,

What's the advantage of the above coding style? seems it saved a flag but add 1 
more jump.

Thanks,
Jinsong

> 
> 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


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