qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] [PATCH 01/11] ppc: Cleanup error handling in


From: David Gibson
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH 01/11] ppc: Cleanup error handling in ppc_set_compat()
Date: Mon, 14 Dec 2015 11:54:34 +1100
User-agent: Mutt/1.5.24 (2015-08-30)

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 <address@hidden>
> > ---
> 
> > @@ -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

[Prev in Thread] Current Thread [Next in Thread]