jerpelea opened a new pull request, #20357: URL: https://github.com/apache/nuttx/pull/20357
## Summary https://github.com/apache/nuttx/pull/7473 established the convention "Don't check the return value of nxsem_init or nxmutex_init", but such checks have since accumulated again in the tree. nxsem_init(), nxsem_destroy(), nxmutex_init(), nxmutex_destroy(), nxrmutex_init() and nxrmutex_destroy() cannot fail — they always return OK — so those checks and the error paths behind them are dead code that the compiler cannot always remove: the -Os stm32f103-minimum:nsh image still keeps three of them (nxmutex_init(), plus the inlined nxrmutex_destroy() in group_leave() and mm_map_destroy()). This PR removes those checks and corrects the return-value documentation of the affected interfaces: remove the two checks inside the implementations — if (ret >= 0) in include/nuttx/mutex.h and if (ret < 0) in libs/libc/misc/lib_mutex.c — and replace the stale "a negated errno value is returned on failure" comment of the six functions with "Zero (OK) is always returned." (5 files); remove the 54 call sites that test these return values (52 assignment + check, 2 conditional). Where err/ret is reused by a later call that can fail, the remaining error handling is kept. No signature, prototype, syscall table entry or POSIX wrapper is touched: all six functions still return int and still forward their value. Three commits: remove the checks (38 files) — correct the return-value comments (5 files) — nxstyle formatting of the touched files (25 files, droppable). ## Impact RELEASE ## Testing CI -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
