From eefabe2f6208e20f6c8d5c58cbe177e83170d1d6 Mon Sep 17 00:00:00 2001 From: Lucas Abad <149054121+lucasAbadFr@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:05:47 +0100 Subject: [PATCH] fix(zephyr): explicit cases handling with single return point --- .../platform/common/posix/posix_sleep.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/core/shared/platform/common/posix/posix_sleep.c b/core/shared/platform/common/posix/posix_sleep.c index cefcfbc78..781f43d08 100644 --- a/core/shared/platform/common/posix/posix_sleep.c +++ b/core/shared/platform/common/posix/posix_sleep.c @@ -28,14 +28,28 @@ __wasi_errno_t os_nanosleep(const os_timespec *req, os_timespec *rem) { int ret = 0; + __wasi_errno_t wasi_ret = __WASI_ESUCCESS; ret = nanosleep(req, rem); switch(ret) { - case 14 /* EFAULT */: return __WASI_EFAULT; - case 4 /* EINTR */: return __WASI_EFAULT; - case 22 /* EINVAL */: return __WASI_EINVAL; - case 0: return __WASI_ESUCCESS; + case 14 /* EFAULT */: + { + wasi_ret = __WASI_EFAULT; + break; + } + case 4 /* EINTR */: + { + wasi_ret = __WASI_EFAULT; + break; + } + case 22 /* EINVAL */: + { + wasi_ret = __WASI_EINVAL; + break; + } } + + return wasi_ret; } \ No newline at end of file