[PATCH 2/8] util: Use unlikely() for L_WARN_ON() condition

Andrew Zaborowski <andrew.zaborowski at intel.com>
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Any condition used in L_WARN_ON() should be only true in an error or
trouble situation and thus be unlikely true.   Add unlikely() directly
in the macro to avoid repeating use of L_WARN_ON(unlikely(condition))
---
 ell/util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ell/util.h b/ell/util.h
index 9d4e36c..db47ae7 100644
--- a/ell/util.h
+++ b/ell/util.h
@@ -49,7 +49,7 @@ _Pragma("GCC diagnostic pop")						\
 
 #define L_WARN_ON(condition) __extension__ ({				\
 		bool r = !!(condition);					\
-		if (r)							\
+		if (unlikely(r))					\
 			l_warn("WARNING: %s:%s() condition %s failed",	\
 				__FILE__, __func__,			\
 				#condition);				\
-- 
2.32.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.