Repository navigation
system/nxinit: drop unreachable error checks - #3938
Merged
xiaoxiang781216 merged 1 commit intoOct 30, 2026
Merged
xiaoxiang781216 merged 1 commit into
xiaoxiang781216 merged 1 commit into
Conversation
init_service_refresh() and init_action_run_command() only return non-negative wait times and report errors through the ppoll() branch below, so the t1/t2 < 0 checks in the main loop are dead code (Coverity). Assisted-by: OpenCode:mimo-v2.6-pro Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
JianyuWang0623
marked this pull request as ready for review
October 29, 2026 13:35
xiaoxiang781216
approved these changes
Oct 29, 2026
cederom
approved these changes
Oct 29, 2026
Contributor
There was a problem hiding this comment.
Thank you @JianyuWang0623 :-)
Can there be a problem when time changes (i.e. due to ntp update)? Was that the main intention? Maybe t2 > t1 check is enough and still necessary?
Contributor
Author
@cederom Thanks for the question. All timestamps are from CLOCK_MONOTONIC, so NTP time jumps cannot result in negative t1/t2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Coverity reports the
t1 < 0/t2 < 0checks in the nxinit main loop asdead code: init_service_refresh() and init_action_run_command() only return
non-negative wait times, and errors are handled by the ppoll() branch below.
Remove the two unreachable checks; behavior is unchanged.
Impact
No behavior change: the removed branches were unreachable. No impact on
build, configuration, documentation, security, or compatibility.
Testing
sim:nsh(apache/nuttx master + this patch; the defconfigenables
CONFIG_SYSTEM_NXINIT=y)uname -a,freeandpoweroffwork asexpected and the process exits with 0.