Skip to contentSkip to conversation

cleanup: bios_error in pc_init1()

PATCH In review Leandro Dorileo 1 participant 2 messages Mar 31, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cleanup: bios_error in pc_init1()

Moved bios_error to the end of pc_init1() function, making the code a bit more readable.

---
 hw/pc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
hw/pc.c +5 -3
index 176730e..7539a4f 100644
@@ -847,9 +847,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     bios_offset = qemu_ram_alloc(bios_size);
     ret = load_image(buf, phys_ram_base + bios_offset);
     if (ret != bios_size) {
-    bios_error:
-        fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf);
-        exit(1);
+        goto bios_error;
     }
 
     if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) {
@@ -1108,6 +1106,10 @@ vga_bios_error:
                 virtio_console_init(pci_bus, virtcon_hds[i]);
         }
     }
+
+bios_error:
+    fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf);
+    exit(1);
 }
 
 static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size,
Signature · 7 lines
1.6.2.1


-- 
(°=   Leandro Dorileo
//\    [email protected]   -   http://www.dorilex.net
V_/  Software is a matter of freedom.
#1 lore raw

Please ignore those patches, it was written based on
git://git.savannah.nongnu.org/qemu.git

Sorry.

Quoted 34 lines · Leandro Dorileo

Moved bios_error to the end of pc_init1() function, making the code a bit more readable.

---
 hw/pc.c |    8 +++++---

 1 files changed, 5 insertions(+), 3 deletions(-)
hw/pc.c +5 -4
index 176730e..7539a4f 100644
@@ -847,9 +847,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     bios_offset = qemu_ram_alloc(bios_size);
     ret = load_image(buf, phys_ram_base + bios_offset);
     if (ret != bios_size) {
-    bios_error:
-        fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf);
-        exit(1);
+        goto bios_error;
     }
 
     if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) {
@@ -1108,6 +1106,10 @@ vga_bios_error:
                 virtio_console_init(pci_bus, virtcon_hds[i]);
         }
     }
+
+bios_error:
+    fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf);
+    exit(1);
  }
 
  static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size,
--
Signature · 3 lines
(°=   Leandro Dorileo
//\    [email protected]   -   http://www.dorilex.net
V_/  Software is a matter of freedom.