Commit 6ea52595474e16888d10eec310b0d156f8bbabc1

Authored by blueswir1
1 parent c190ea07

Fix segfault

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6267 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 6 deletions
hw/sun4m.c
@@ -533,8 +533,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, @@ -533,8 +533,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
533 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, 533 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
534 hwdef->vram_size, graphic_width, graphic_height, graphic_depth); 534 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
535 535
536 - if (nd_table[0].model == NULL  
537 - || strcmp(nd_table[0].model, "lance") == 0) { 536 + if (nd_table[0].model == NULL)
  537 + nd_table[0].model = "lance";
  538 + if (strcmp(nd_table[0].model, "lance") == 0) {
538 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); 539 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
539 } else if (strcmp(nd_table[0].model, "?") == 0) { 540 } else if (strcmp(nd_table[0].model, "?") == 0) {
540 fprintf(stderr, "qemu: Supported NICs: lance\n"); 541 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, @@ -1325,8 +1326,9 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
1325 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, 1326 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
1326 hwdef->vram_size, graphic_width, graphic_height, graphic_depth); 1327 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
1327 1328
1328 - if (nd_table[0].model == NULL  
1329 - || strcmp(nd_table[0].model, "lance") == 0) { 1329 + if (nd_table[0].model == NULL)
  1330 + nd_table[0].model = "lance";
  1331 + if (strcmp(nd_table[0].model, "lance") == 0) {
1330 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); 1332 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
1331 } else if (strcmp(nd_table[0].model, "?") == 0) { 1333 } else if (strcmp(nd_table[0].model, "?") == 0) {
1332 fprintf(stderr, "qemu: Supported NICs: lance\n"); 1334 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, @@ -1540,8 +1542,9 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
1540 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, 1542 tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
1541 hwdef->vram_size, graphic_width, graphic_height, graphic_depth); 1543 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
1542 1544
1543 - if (nd_table[0].model == NULL  
1544 - || strcmp(nd_table[0].model, "lance") == 0) { 1545 + if (nd_table[0].model == NULL)
  1546 + nd_table[0].model = "lance";
  1547 + if (strcmp(nd_table[0].model, "lance") == 0) {
1545 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); 1548 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
1546 } else if (strcmp(nd_table[0].model, "?") == 0) { 1549 } else if (strcmp(nd_table[0].model, "?") == 0) {
1547 fprintf(stderr, "qemu: Supported NICs: lance\n"); 1550 fprintf(stderr, "qemu: Supported NICs: lance\n");