sched/clock: remove return value of clock_systime_timespec()

clock_systime_timespec() always returns 0, so there is no need to
check the return value in the caller code, let us remove the return
value directly.

Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
chao an 2025-09-28 15:28:19 +08:00 committed by Xiang Xiao
parent 84b0492fbd
commit 4c7deedd27
10 changed files with 84 additions and 59 deletions

View file

@ -0,0 +1,58 @@
From a120e0e698ff3f7af8bfee34a47051f13b74aac0 Mon Sep 17 00:00:00 2001
From: chao an <anchao.archer@bytedance.com>
Date: Thu, 9 Oct 2025 19:39:01 +0800
Subject: [PATCH] libmetal/nuttx: Update function prototype changes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
clock_systime_timespec() always returns 0, so there is no need to
check the return value in the caller code, let us remove the return
value directly.
From:
int clock_systime_timespec(FAR struct timespec *ts)
To:
void clock_systime_timespec(FAR struct timespec *ts)
Fix build break:
libmetal/lib/system/nuttx/time.c: In function metal_get_timestamp:
libmetal/lib/system/nuttx/time.c:21:11: error: void value not ignored as it ought to be
21 | r = clock_systime_timespec(&tp);
| ^
make[1]: *** [Makefile:46: libmetal/lib/system/nuttx/time.o] Error 1
Change-Id: I88443c4a5725bd269a05c8a503bd5095b082bfbe
---
lib/system/nuttx/time.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/system/nuttx/time.c libmetal/lib/system/nuttx/time.c
index 986f1ba..f06725d 100644
--- a/lib/system/nuttx/time.c
+++ libmetal/lib/system/nuttx/time.c
@@ -14,14 +14,13 @@
unsigned long long metal_get_timestamp(void)
{
- unsigned long long t = 0;
+ unsigned long long t;
struct timespec tp;
- int r;
- r = clock_systime_timespec(&tp);
- if (!r) {
- t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC;
- t += tp.tv_nsec;
- }
+ clock_systime_timespec(&tp);
+
+ t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC;
+ t += tp.tv_nsec;
+
return t;
}
--
2.43.0

View file

@ -48,6 +48,8 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libmetal)
${CMAKE_CURRENT_LIST_DIR}/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0007-libmetal-nuttx-Update-function-prototype-changes.patch
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

View file

@ -88,6 +88,7 @@ libmetal.zip:
$(Q) patch -p0 < 0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch
$(Q) patch -p0 < 0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
$(Q) patch -p0 < 0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch
$(Q) patch -p0 < 0007-libmetal-nuttx-Update-function-prototype-changes.patch
.libmetal_headers: libmetal.zip
else