diff mbox series

[RISU,v2,12/17] Simplify syncing with master

Message ID 20200519025355.4420-13-richard.henderson@linaro.org
State Superseded
Headers show
Series risu cleanups and improvements | expand

Commit Message

Richard Henderson May 19, 2020, 2:53 a.m. UTC
Do not pass status like RES_BAD_IO from apprentice to master.
This means that when master reports i/o error that we know it
came from master; the apprentice will report its own i/o error.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 reginfo.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

-- 
2.20.1

Comments

Alex Bennée May 20, 2020, 4:14 p.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> Do not pass status like RES_BAD_IO from apprentice to master.

> This means that when master reports i/o error that we know it

> came from master; the apprentice will report its own i/o error.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


-- 
Alex Bennée
diff mbox series

Patch

diff --git a/reginfo.c b/reginfo.c
index c37c5df..31bc699 100644
--- a/reginfo.c
+++ b/reginfo.c
@@ -90,10 +90,9 @@  RisuResult recv_and_compare_register_info(void *uc)
     }
 
     if (header.risu_op != op) {
-        /* We are out of sync */
-        res = RES_BAD_IO;
-        respond(res);
-        return res;
+        /* We are out of sync.  Tell master to exit. */
+        respond(RES_END);
+        return RES_BAD_IO;
     }
 
     /* send OK for the header */
@@ -115,7 +114,7 @@  RisuResult recv_and_compare_register_info(void *uc)
         } else if (op == OP_TESTEND) {
             res = RES_END;
         }
-        respond(res);
+        respond(res == RES_OK ? RES_OK : RES_END);
         break;
     case OP_SETMEMBLOCK:
         memblock = (void *)(uintptr_t)get_reginfo_paramreg(&apprentice_ri);
@@ -133,7 +132,7 @@  RisuResult recv_and_compare_register_info(void *uc)
             /* memory mismatch */
             res = RES_MISMATCH;
         }
-        respond(res);
+        respond(res == RES_OK ? RES_OK : RES_END);
         break;
     default:
         abort();