semihosting: Clean up common_semi_open_cb
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 17 May 2022 02:37:14 +0000 (19:37 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 27 Jun 2022 23:05:07 +0000 (04:35 +0530)
Use common_semi_cb to return results instead of calling
set_swi_errno and common_semi_set_ret directly.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
semihosting/arm-compat-semi.c

index cc13fcb0efa22b639042dda71d0a9b0766a29938..6414caa7496f25f7b4f51c2ece9b259b8c1b70c0 100644 (file)
@@ -364,15 +364,13 @@ static int common_semi_open_guestfd;
 static void
 common_semi_open_cb(CPUState *cs, target_ulong ret, target_ulong err)
 {
-    if (ret == (target_ulong)-1) {
-        errno = err;
-        set_swi_errno(cs, -1);
+    if (err) {
         dealloc_guestfd(common_semi_open_guestfd);
     } else {
         associate_guestfd(common_semi_open_guestfd, ret);
         ret = common_semi_open_guestfd;
     }
-    common_semi_set_ret(cs, ret);
+    common_semi_cb(cs, ret, err);
 }
 
 static target_ulong