Immutable branch for once_lite.h context analysis fix

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQR74yXHMTGczQHYypIdayaRccAalgUCaqCkQQAKCRAdayaRccAa
 lmZnAP46StQo9t1n2X73W1/QHYUvSg+UjzQ0CpHgkglKvF3hCwEA6ytvp4CJQJrI
 seAcIDKBLqs+esY5PLEDHR5NHDpw7w4=
 =6W+V
 -----END PGP SIGNATURE-----

Merge tag 'clang-fixes-once_lite-for-7.4' of https://git.kernel.org/pub/scm/linux/kernel/git/nathan/linux

Pull fix for clang context analysis in once_lite. This fixes false
positive reports from clang context analysis of ext2.
This commit is contained in:
Jan Kara 2026-09-09 11:42:15 +02:00
commit a4ed759939

View File

@ -10,19 +10,21 @@
#define DO_ONCE_LITE(func, ...) \
DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)
#define __ONCE_LITE_IF(condition) \
#define __ONCE_LITE() \
({ \
static bool __section(".data..once") __already_done; \
bool __ret_cond = !!(condition); \
bool __ret_once = false; \
\
if (unlikely(__ret_cond) && unlikely(!__already_done)) {\
if (unlikely(!__already_done)) { \
__already_done = true; \
__ret_once = true; \
} \
unlikely(__ret_once); \
})
#define __ONCE_LITE_IF(condition) \
(unlikely(condition) && __ONCE_LITE())
#define DO_ONCE_LITE_IF(condition, func, ...) \
({ \
bool __ret_do_once = !!(condition); \