From 6ea52595474e16888d10eec310b0d156f8bbabc1 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sat, 10 Jan 2009 14:38:00 +0000 Subject: [PATCH] Fix segfault git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6267 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/sun4m.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/sun4m.c b/hw/sun4m.c index e6a538a9f3..b7bd51f39d 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -533,8 +533,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, hwdef->vram_size, graphic_width, graphic_height, graphic_depth); - if (nd_table[0].model == NULL - || strcmp(nd_table[0].model, "lance") == 0) { + if (nd_table[0].model == NULL) + nd_table[0].model = "lance"; + if (strcmp(nd_table[0].model, "lance") == 0) { lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: lance\n"); @@ -1325,8 +1326,9 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size, tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, hwdef->vram_size, graphic_width, graphic_height, graphic_depth); - if (nd_table[0].model == NULL - || strcmp(nd_table[0].model, "lance") == 0) { + if (nd_table[0].model == NULL) + nd_table[0].model = "lance"; + if (strcmp(nd_table[0].model, "lance") == 0) { lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: lance\n"); @@ -1540,8 +1542,9 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size, tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, hwdef->vram_size, graphic_width, graphic_height, graphic_depth); - if (nd_table[0].model == NULL - || strcmp(nd_table[0].model, "lance") == 0) { + if (nd_table[0].model == NULL) + nd_table[0].model = "lance"; + if (strcmp(nd_table[0].model, "lance") == 0) { lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: lance\n");