[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |