On Fri, Dec 11, 2015 at 06:58:12AM -0700, Eric Blake wrote:
> On 12/10/2015 05:11 PM, David Gibson wrote:
> > Current ppc_set_compat() returns -1 for errors, and also (unconditionally)
> > reports an error message.  The caller in h_client_architecture_support()
> > may then report it again using an outdated fprintf().
> > 
> > Clean this up by using the modern error reporting mechanisms.
> > 
> > Signed-off-by: David Gibson <da...@gibson.dropbear.id.au>
> > ---
> 
> > @@ -9208,12 +9208,13 @@ int ppc_set_compat(PowerPCCPU *cpu, uint32_t 
> > cpu_version)
> >          break;
> >      }
> >  
> > -    if (kvm_enabled() && kvmppc_set_compat(cpu, cpu->cpu_version) < 0) {
> > -        error_report("Unable to set compatibility mode in KVM");
> > -        ret = -1;
> > +    if (kvm_enabled()) {
> > +        ret = kvmppc_set_compat(cpu, cpu->cpu_version);
> > +        if (ret < 0) {
> > +            error_setg(errp, "Unable to set CPU compatibility mode in KVM: 
> > %s",
> > +                       strerror(-ret));
> > +        }
> 
> Could use error_setg_errno() here instead of manually calling strerror().

Ah, thanks, I hadn't spotted that function before.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature

Reply via email to