]> Git Repo - J-u-boot.git/commitdiff
log: Fix up debug_cond() when LOG is enabled
authorSimon Glass <[email protected]>
Fri, 26 Mar 2021 03:17:28 +0000 (16:17 +1300)
committerSimon Glass <[email protected]>
Tue, 6 Apr 2021 04:33:19 +0000 (16:33 +1200)
At present debug() statements can cause debuf output to appear when LOG is
enabled but DEBUG is not. This is not intended and it seems that the
condition is wrong.

Fix it.

Signed-off-by: Simon Glass <[email protected]>
include/log.h

index 6ef891d4d2d2cf9e66e2706b03cf900c090d1973..add3a1e4a0c5abec9f59bdb48aa3dd8c1fafd78e 100644 (file)
@@ -222,11 +222,14 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
 #define _SPL_BUILD     0
 #endif
 
-#if !_DEBUG && CONFIG_IS_ENABLED(LOG)
+#if CONFIG_IS_ENABLED(LOG)
 
-#define debug_cond(cond, fmt, args...)                 \
-({                                                     \
-       log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args);     \
+#define debug_cond(cond, fmt, args...)                                 \
+({                                                                     \
+       if (cond)                                                       \
+               log(LOG_CATEGORY,                                       \
+                   (enum log_level_t)(LOGL_FORCE_DEBUG | _LOG_DEBUG),  \
+                   fmt, ##args);                                       \
 })
 
 #else /* _DEBUG */
This page took 0.035556 seconds and 4 git commands to generate.