qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] spar: remove extra type variable
@ 2016-08-09 11:15 Cédric Le Goater
  2016-08-09 11:32 ` Thomas Huth
  2016-08-10  4:47 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2016-08-09 11:15 UTC (permalink / raw)
  To: qemu-ppc
  Cc: David Gibson, Bharata B Rao, qemu-devel, Thomas Huth,
	Cédric 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édric Le Goater <clg@kaod.org>
---
 hw/ppc/spapr.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
===================================================================
--- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c
+++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c
@@ -1772,6 +1772,11 @@ static void ppc_spapr_init(MachineState
     if (mc->query_hotpluggable_cpus) {
         char *type = spapr_get_cpu_core_type(machine->cpu_model);
 
+        if (!object_class_by_name(type)) {
+            error_report("Unable to find sPAPR CPU Core definition");
+            exit(1);
+        }
+
         spapr->cores = g_new0(Object *, spapr_max_cores);
         for (i = 0; i < spapr_max_cores; i++) {
             int core_id = i * smp_threads;
@@ -1783,15 +1788,7 @@ static void ppc_spapr_init(MachineState
             qemu_register_reset(spapr_drc_reset, drc);
 
             if (i < spapr_cores) {
-                char *type = spapr_get_cpu_core_type(machine->cpu_model);
-                Object *core;
-
-                if (!object_class_by_name(type)) {
-                    error_report("Unable to find sPAPR CPU Core definition");
-                    exit(1);
-                }
-
-                core  = object_new(type);
+                Object *core  = object_new(type);
                 object_property_set_int(core, smp_threads, "nr-threads",
                                         &error_fatal);
                 object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-10  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 11:15 [Qemu-devel] [PATCH v2] spar: remove extra type variable Cédric Le Goater
2016-08-09 11:32 ` Thomas Huth
2016-08-10  4:47 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).