Skip to contentSkip to conversation

main loop: remove useless code

PATCH In review FelixYao 2 participants 3 messages Dec 2, 2017 – Dec 4, 2017

lore
Share & tools
lore

FelixYao

author
#0 lore raw

PATCH 1/1 main loop: remove useless code

hi Paolo Bonzini:

Those codes seem useless, Could it be removed?

---
 vl.c | 4 ----
 1 file changed, 4 deletions(-)
vl.c +0 -4
index 1ad1c04..5bed4c2 100644
@@ -2995,10 +2995,6 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
 
     sz = QEMU_ALIGN_UP(sz, 8192);
     ram_size = sz;
-    if (ram_size != sz) {
-        error_report("ram size too large");
-        exit(EXIT_FAILURE);
-    }
 
     /* store value for the future use */
     qemu_opt_set_number(opts, "size", ram_size, &error_abort);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · FelixYao

hi Paolo Bonzini:

Those codes seem useless, Could it be removed?

---
 vl.c | 4 ----
 1 file changed, 4 deletions(-)
vl.c +0 -0
index 1ad1c04..5bed4c2 100644

vl.c static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, · line 3001

Quoted 7 lines
vl.c +0 -4
@@ -2995,10 +2995,6 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
 
     sz = QEMU_ALIGN_UP(sz, 8192);
     ram_size = sz;
-    if (ram_size != sz) {
-        error_report("ram size too large");
-        exit(EXIT_FAILURE);
-    }

ram_size is a ramaddr_t, which may be a 32-bit variable, whereas sz is a uint64_t. This check is making sure that the ram size specified can actually fit in a ramaddr_t.

thanks
-- PMM

author
#2 lore raw

Hi Peter Maydell:

Got it, thank you very much!

2017-12-02 19:52 GMT+08:00 Peter Maydell <[email protected]>:

Quoted 31 lines · FelixYao

vl.c static void set_memory_options(uint64_t

Quoted 14 lines

hi Paolo Bonzini:

Those codes seem useless, Could it be removed?

---
 vl.c | 4 ----
 1 file changed, 4 deletions(-)
vl.c +0 -0
index 1ad1c04..5bed4c2 100644
@@ -2995,10 +2995,6 @@ static void set_memory_options(uint64_t

*ram_slots, ram_addr_t *maxram_size,

vl.c static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, · line 3001

Quoted 7 lines
vl.c +0 -4
     sz = QEMU_ALIGN_UP(sz, 8192);
     ram_size = sz;
-    if (ram_size != sz) {
-        error_report("ram size too large");
-        exit(EXIT_FAILURE);
-    }

ram_size is a ramaddr_t, which may be a 32-bit variable, whereas sz is a uint64_t. This check is making sure that the ram size specified can actually fit in a ramaddr_t.

thanks
-- PMM