Skip to contentSkip to conversation

target-openrisc hw/openrisc: Some OpenRISC fix.

PATCH In review Jia Liu 2 participants 5 messages Jul 22, 2013

lore
Share & tools
lore

Jia Liu

author
#0 lore raw

v4 cover target-openrisc hw/openrisc: Some OpenRISC fix.

Fix OpenRISC CPU and sim broad.

We should free typename in openrisc_cpu_class_by_name, and we should use stderr output in openrisc_sim.c.

Updates from V4:
* Remove a not needed patch.

Updates from V3:
* Replace a typo fix using a stderr fix.

Updates from V2:
* Combine typo patchset and typename free.

Jia Liu (3):
hw/openrisc: Indent typo
hw/openrisc: Use stderr output instead of qemu_log
target-openrisc: Free typename in openrisc_cpu_class_by_name

 hw/openrisc/openrisc_sim.c | 6 +++---
 target-openrisc/cpu.c      | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.12.4 (Apple Git-37)
author
#1 lore raw

PATCH v4 1/3 hw/openrisc: Indent typo

Indent typo.

---
 hw/openrisc/openrisc_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/openrisc/openrisc_sim.c +1 -1
index 924438b..250f5b5 100644
@@ -96,7 +96,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)
     ram_addr_t ram_size = args->ram_size;
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
-   OpenRISCCPU *cpu = NULL;
+    OpenRISCCPU *cpu = NULL;
     MemoryRegion *ram;
     int n;
 
Signature · 1 line
1.7.12.4 (Apple Git-37)
author
#2 lore raw

PATCH v4 2/3 hw/openrisc: Use stderr output instead of qemu_log

In reply to Jia Liu

We should use stderr output instead of qemu_log in order to output ErrMsg onto the screen.

---
 hw/openrisc/openrisc_sim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/openrisc/openrisc_sim.c +2 -2
index 250f5b5..a08f27c 100644
@@ -82,7 +82,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
         }
 
         if (kernel_size < 0) {
-            qemu_log("QEMU: couldn't load the kernel '%s'\n",
+            fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",
                     kernel_filename);
             exit(1);
         }
@@ -107,7 +107,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)
     for (n = 0; n < smp_cpus; n++) {
         cpu = cpu_openrisc_init(cpu_model);
         if (cpu == NULL) {
-            qemu_log("Unable to find CPU definition!\n");
+            fprintf(stderr, "Unable to find CPU definition!\n");
             exit(1);
         }
         qemu_register_reset(main_cpu_reset, cpu);
Signature · 1 line
1.7.12.4 (Apple Git-37)
author
#3 lore raw

PATCH v4 3/3 target-openrisc: Free typename in openrisc_cpu_class_by_name

In reply to Jia Liu

We should free typename here.

---
 target-openrisc/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target-openrisc/cpu.c +1 -0
index 6d40f1b..e348df0 100644
@@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
 
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
+    g_free(typename);
     if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
                        object_class_is_abstract(oc))) {
         return NULL;
Signature · 1 line
1.7.12.4 (Apple Git-37)
Reviewed-by on the v4 series
#4 lore raw
In reply to Jia Liu

Am 22.07.2013 12:30, schrieb Jia Liu:

Quoted 4 lines

Jia Liu (3):
hw/openrisc: Indent typo
hw/openrisc: Use stderr output instead of qemu_log
target-openrisc: Free typename in openrisc_cpu_class_by_name

Remainder of v4 series:

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg