From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXMIw-0006oq-A0 for qemu-devel@nongnu.org; Wed, 10 Aug 2016 01:43:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXMIr-0001SM-W2 for qemu-devel@nongnu.org; Wed, 10 Aug 2016 01:43:49 -0400 From: David Gibson Date: Wed, 10 Aug 2016 15:45:37 +1000 Message-Id: <1470807941-25931-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1470807941-25931-1-git-send-email-david@gibson.dropbear.id.au> References: <1470807941-25931-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 2/6] spapr: remove extra type variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de, thuth@redhat.com, lvivier@redhat.com, bharata@linux.vnet.ibm.com, imammedo@redhat.com, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson 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 Signed-off-by: David Gibson --- 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 2.7.4