Skip to contentSkip to conversation

arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()

PATCH Applied Chen Gang 2 participants 2 messages May 1, 2014 – May 3, 2014

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()

When DPRINTF() has effect, the original author wants to print all ram_load() calling results. So need use 'goto' instead of 'return' within ram_load(), just like other areas have done.

---
 arch_init.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
arch_init.c +8 -4
index 60c975d..333f698 100644
@@ -998,7 +998,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
     seq_iter++;
 
     if (version_id < 4 || version_id > 4) {
-        return -EINVAL;
+        ret = -EINVAL;
+        goto done;
     }
 
     do {
@@ -1055,7 +1056,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
 
             host = host_from_stream_offset(f, addr, flags);
             if (!host) {
-                return -EINVAL;
+                ret = -EINVAL;
+                goto done;
             }
 
             ch = qemu_get_byte(f);
@@ -1065,14 +1067,16 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
 
             host = host_from_stream_offset(f, addr, flags);
             if (!host) {
-                return -EINVAL;
+                ret = -EINVAL;
+                goto done;
             }
 
             qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
         } else if (flags & RAM_SAVE_FLAG_XBZRLE) {
             void *host = host_from_stream_offset(f, addr, flags);
             if (!host) {
-                return -EINVAL;
+                ret = -EINVAL;
+                goto done;
             }
 
             if (load_xbzrle(f, addr, host) < 0) {
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 3 lines · Chen Gang

When DPRINTF() has effect, the original author wants to print all ram_load() calling results. So need use 'goto' instead of 'return' within ram_load(), just like other areas have done.

Applied to -trivial, thank you!

/mjjt