[libvirt] [PATCH 2/4] cpu: Better support for ppc64 compatibility modes

Jiri Denemark jdenemar at redhat.com
Fri Aug 21 21:58:58 UTC 2015


On Fri, Aug 21, 2015 at 14:55:02 -0700, Andrea Bolognani wrote:
> On Fri, 2015-08-21 at 14:27 -0700, Jiri Denemark wrote:
> 
> > > +static virCPUCompareResult
> > > +ppc64CheckCompatibilityMode(const char *host_model,
> > > +                            const char *compat_mode)
> > > +{
> > > +    int host;
> > > +    int compat;
> > > +    char *tmp;
> > > +    virCPUCompareResult ret = VIR_CPU_COMPARE_IDENTICAL;
> > 
> > Shouldn't ret be initialized to VIR_CPU_COMPARE_ERROR so that we
> > don't
> > report everything is OK on errors?
> 
> Initializing it to VIR_CPU_COMPARE_IDENTICAL allows us to
> just jump to the exit point if a compatibility mode is not
> used (see check right below).
> 
> That could be replaced with an explicit return if you
> think that would make the code easier to understand.

Oops, I'm blind, I completely missed the "ret = VIR_CPU_COMPARE_ERROR"
after the check. But yes, I think initializing to *_ERROR and an
explicit return if compatibility mode is not used would be more
readable.

Jirka




More information about the libvir-list mailing list