qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [PATCH RFC 3/8] target-i386: cpu: use cpu_generic_init()


From: Eduardo Habkost
Subject: Re: [Qemu-arm] [PATCH RFC 3/8] target-i386: cpu: use cpu_generic_init() in cpu_x86_init()
Date: Wed, 1 Jun 2016 15:08:02 -0300
User-agent: Mutt/1.6.1 (2016-04-27)

On Wed, Jun 01, 2016 at 06:37:25PM +0200, Igor Mammedov wrote:
> now cpu_x86_init() does nothing more or less
> than duplicating cpu_generic_init() logic.
> So simplify it by using cpu_generic_init().
> 
> Signed-off-by: Igor Mammedov <address@hidden>

Awesome.

It bothers me that we're replacing a function with consistent
error reporting with one where error reporting is inconsistent.
cpu_generic_init() sometimes prints error messages, and sometimes
simply returns NULL without printing anything.

But fixing that would require reviewing all cpu_init()
implementations. In the meantime, we are being as inconsistent as
all the other architectures that already use cpu_generic_init(),
so:

Reviewed-by: Eduardo Habkost <address@hidden>

> ---
>  target-i386/cpu.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index c31afc7..238f69d 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2240,25 +2240,7 @@ out:
>  
>  X86CPU *cpu_x86_init(const char *cpu_model)
>  {
> -    Error *error = NULL;
> -    X86CPU *cpu;
> -
> -    cpu = cpu_x86_create(cpu_model, &error);
> -    if (error) {
> -        goto out;
> -    }
> -
> -    object_property_set_bool(OBJECT(cpu), true, "realized", &error);
> -
> -out:
> -    if (error) {
> -        error_report_err(error);
> -        if (cpu != NULL) {
> -            object_unref(OBJECT(cpu));
> -            cpu = NULL;
> -        }
> -    }
> -    return cpu;
> +    return X86_CPU(cpu_generic_init(TYPE_X86_CPU, cpu_model));
>  }
>  
>  static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data)
> -- 
> 1.8.3.1
> 

-- 
Eduardo



reply via email to

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