Re: [PATCH] Fix redundant judgment in WARN_ONCE with clang

From: Xie Yuanbin
Date: Mon Nov 10 2025 - 09:40:23 EST


On Sun, 9 Nov 2025 09:03:17 -0800, Andrew Morton wrote:
> It's a shame you messed with the whitespace. And I don't think it was
> necessary anyway. Here's what it would have looked like:
>
> --- a/include/linux/once_lite.h~fix-redundant-judgment-in-warn_once-with-clang
> +++ a/include/linux/once_lite.h
> @@ -16,7 +16,7 @@
> bool __ret_cond = !!(condition); \
> bool __ret_once = false; \
> \
> - if (unlikely(__ret_cond && !__already_done)) { \
> + if (unlikely(__ret_cond) && unlikely(!__already_done)) {\
> __already_done = true; \
> __ret_once = true; \
> } \

Okay, thanks, I will send the v2 patch.

Xie Yuanbin