sched/sched: fix casting issue found by coverity #18278
Open
+20
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improve clock conversion infrastructure with MISRA compliance and new conversion macros
This PR addresses code quality improvements in NuttX time conversion utilities through two key enhancements: fixing MISRA C-2012 compliance issues in existing clock conversion macros and adding a missing USEC2MSEC macro for improved API consistency.
The first commit ensures all clock conversion macros in include/nuttx/clock.h comply with MISRA C-2012 type conversion rules by adding explicit type casts to uint32_t for divisor parameters in macros including NSEC2TICK, USEC2TICK, MSEC2TICK, TICK2MSEC, TICK2DSEC, TICK2HSEC, TICK2SEC, MSEC2SEC, USEC2MSEC, USEC2SEC, NSEC2USEC, NSEC2MSEC, and the clock time conversion macros. This also resolves related Coverity warnings and improves type safety throughout the clock subsystem.
The second commit adds the USEC2MSEC macro which was missing from the comprehensive set of time unit conversion utilities, providing developers with a consistent and convenient interface for converting microseconds to milliseconds.
Summary
TEST
test log in hardware with esp32s3-devkit:nsh