[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/20 v2] target-i386: cpu_x86_register() consol
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 07/20 v2] target-i386: cpu_x86_register() consolidate freeing resources |
Date: |
Wed, 19 Dec 2012 17:49:22 +0100 |
On Wed, 19 Dec 2012 14:36:28 -0200
Eduardo Habkost <address@hidden> wrote:
> On Tue, Dec 18, 2012 at 05:30:43PM +0100, Igor Mammedov wrote:
> > freeing resources in one place would require setting 'error'
> > to not NULL, so add some more error reporting before jumping to
> > exit branch.
> >
> > Signed-off-by: Igor Mammedov <address@hidden>
> > ---
> > v2:
> > - add missing 'return -1' on exit if error is not NULL,
> > Spotted-By: Eduardo Habkost <address@hidden>
> > ---
> > target-i386/cpu.c | 17 ++++++++---------
> > 1 files changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index 3b9bbfe..fe8b76c 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -1550,13 +1550,14 @@ int cpu_x86_register(X86CPU *cpu, const char
> > *cpu_model)
> > model_pieces = g_strsplit(cpu_model, ",", 2);
> > if (!model_pieces[0]) {
> > - goto error;
> > + goto out;
>
> Missing error_set*() call here.
Thinking about this error path, it looks like it's unreachable, because of
every caller of cpu_init() passes in not empty cpu_model.
Perhaps it would make sense to just assert(cpu_model) at the beginning of
function and delete this error check.
>
> The rest of the patch looks good, to me. I liked this style of handling
> errors & freeing resources.
>
>
[snip]
[Qemu-devel] [PATCH 08/20] target-i386: compile kvm only functions if CONFIG_KVM is defined, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 14/20] target-i386: set custom 'vendor' without intermediate x86_def_t, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 09/20] target-i386: move kvm_check_features_against_host() check to realize time, Igor Mammedov, 2012/12/17
[Qemu-devel] [PATCH 13/20] target-i386: convert [cpuid_]vendor_override to bool, Igor Mammedov, 2012/12/17