From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXANw-0006fw-4g for qemu-devel@nongnu.org; Tue, 09 Aug 2016 13:00:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXANs-0002xO-W0 for qemu-devel@nongnu.org; Tue, 09 Aug 2016 13:00:11 -0400 From: Thomas Huth Date: Tue, 9 Aug 2016 18:59:57 +0200 Message-Id: <1470762001-414-2-git-send-email-thuth@redhat.com> In-Reply-To: <1470762001-414-1-git-send-email-thuth@redhat.com> References: <1470762001-414-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 1/5] spapr: remove extra type variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , qemu-ppc@nongnu.org Cc: Alexander Graf , qemu-devel@nongnu.org, abologna@redhat.com, bharata@linux.vnet.ibm.com, clg@kaod.org From: C=C3=A9dric Le Goater The sPAPR CPU core typename is already available in the upper block. Let's use it and move the check upward also. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 57564e5..399dcc0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1815,6 +1815,11 @@ static void ppc_spapr_init(MachineState *machine) if (mc->query_hotpluggable_cpus) { char *type =3D spapr_get_cpu_core_type(machine->cpu_model); =20 + if (!object_class_by_name(type)) { + error_report("Unable to find sPAPR CPU Core definition"); + exit(1); + } + spapr->cores =3D g_new0(Object *, spapr_max_cores); for (i =3D 0; i < spapr_max_cores; i++) { int core_id =3D i * smp_threads; @@ -1826,15 +1831,7 @@ static void ppc_spapr_init(MachineState *machine) qemu_register_reset(spapr_drc_reset, drc); =20 if (i < spapr_cores) { - char *type =3D spapr_get_cpu_core_type(machine->cpu_mode= l); - Object *core; - - if (!object_class_by_name(type)) { - error_report("Unable to find sPAPR CPU Core definiti= on"); - exit(1); - } - - core =3D object_new(type); + Object *core =3D object_new(type); object_property_set_int(core, smp_threads, "nr-threads", &error_fatal); object_property_set_int(core, core_id, CPU_CORE_PROP_COR= E_ID, --=20 1.8.3.1