From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLwuk-0004vK-DG for qemu-devel@nongnu.org; Wed, 10 Oct 2012 10:05:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLwuT-0002tP-2r for qemu-devel@nongnu.org; Wed, 10 Oct 2012 10:05:34 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40142 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLwuS-0002sH-Pq for qemu-devel@nongnu.org; Wed, 10 Oct 2012 10:05:17 -0400 Message-ID: <50758096.6000805@suse.de> Date: Wed, 10 Oct 2012 16:05:10 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1349192235-31895-1-git-send-email-imammedo@redhat.com> <1349192235-31895-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1349192235-31895-2-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 01/23] target-i386: return Error from cpu_x86_find_by_name() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , Luiz Capitulino Cc: aliguori@us.ibm.com, akong@redhat.com, ehabkost@redhat.com, jan.kiszka@siemens.com, Don@cloudswitch.com, mtosatti@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, hpa@linux.intel.com, lersek@redhat.com, stefanha@linux.vnet.ibm.com Am 02.10.2012 17:36, schrieb Igor Mammedov: > it will allow to use property setters there later. >=20 > Signed-off-by: Igor Mammedov > Reviewed-by: Don Slutz > Reviewed-by: Eduardo Habkost > -- > v2: > - style change, add braces (reqested by Blue Swirl) > - removed unused error_is_set(errp) in properties set loop > --- > target-i386/cpu.c | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) >=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index bb1e44e..e1ffa40 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1097,7 +1097,8 @@ static void x86_cpuid_set_tsc_freq(Object *obj, V= isitor *v, void *opaque, > cpu->env.tsc_khz =3D value / 1000; > } > =20 > -static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cp= u_model) > +static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, > + const char *cpu_model, Error **errp) > { > unsigned int i; > x86_def_t *def; > @@ -1254,6 +1255,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cp= u_def, const char *cpu_model) > fprintf(stderr, "feature string `%s' not in format (+featu= re|-feature|feature=3Dxyz)\n", featurestr); > goto error; > } > + > featurestr =3D strtok(NULL, ","); > } > x86_cpu_def->features |=3D plus_features; Disconnected whitespace change. > @@ -1282,6 +1284,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cp= u_def, const char *cpu_model) > =20 > error: > g_free(s); > + if (!error_is_set(errp)) { > + error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); Note to self: error_set() checks for errp being NULL, so the use of !error_is_set() logic seems fine. QERR_ alarm - acceptable use? Or better use error_setg() or something? Otherwise looks okay to me, I could drop the whitespace hunk myself. Andreas > + } > return -1; > } > =20 > @@ -1368,8 +1373,10 @@ int cpu_x86_register(X86CPU *cpu, const char *cp= u_model) > =20 > memset(def, 0, sizeof(*def)); > =20 > - if (cpu_x86_find_by_name(def, cpu_model) < 0) > - return -1; > + if (cpu_x86_find_by_name(cpu, def, cpu_model, &error) < 0) { > + goto out; > + } > + > if (def->vendor1) { > env->cpuid_vendor1 =3D def->vendor1; > env->cpuid_vendor2 =3D def->vendor2; > @@ -1419,6 +1426,8 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu= _model) > env->cpuid_svm_features &=3D TCG_SVM_FEATURES; > } > object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &e= rror); > + > +out: > if (error_is_set(&error)) { > error_free(error); > return -1; >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg