ext4l: Fix cmpxchg macro warning with clang

Rename local variables in cmpxchg macro to avoid shadowing when used
inside try_cmpxchg, which also declares __old. Clang complains about
"variable '__old' is uninitialised when used within its own
initialisation" due to the nested macro expansion.

Cover-letter:
ext4l: Infrastructure and fixes for write support (part K)
This series adds infrastructure and bug fixes needed for ext4l write
support. It includes:

- kmem_cache implementation controlled by CONFIG_LIB_KMEM_CACHE
- Bit operation functions imported from Linux (find_bit, fns)
- Little-endian bit operations for ext4 bitmaps
- Buffer I/O infrastructure for write operations
- Folio and buffer head fixes for U-Boot's malloc'd buffers
- Inode handling fixes (i_mode, i_blocks, iput eviction)
- Journal cleanup detection in bh_cache_clear()
- Various bug fixes for clang warnings and multi-word bit operations
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-30 11:37:51 -07:00
parent 0d7e4430e3
commit 5b792aad9e

View File

@@ -101,12 +101,12 @@ struct timespec64 {
/* cmpxchg - compare and exchange, single-threaded version */
#define cmpxchg(ptr, old, new) ({ \
typeof(*(ptr)) __old = (old); \
typeof(*(ptr)) __new = (new); \
typeof(*(ptr)) __ret = *(ptr); \
if (__ret == __old) \
*(ptr) = __new; \
__ret; \
typeof(*(ptr)) __cmpxchg_old = (old); \
typeof(*(ptr)) __cmpxchg_new = (new); \
typeof(*(ptr)) __cmpxchg_ret = *(ptr); \
if (__cmpxchg_ret == __cmpxchg_old) \
*(ptr) = __cmpxchg_new; \
__cmpxchg_ret; \
})
/* Reference count type */