[dpdk-dev] [PATCH 1/3] log: choose EAL log type on registration failure

Thomas Monjalon thomas at monjalon.net
Wed Mar 10 15:01:05 CET 2021


In the unlikely case where something goes wrong
while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
 lib/librte_eal/include/rte_log.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h
index e6192892c3..178a265c3f 100644
--- a/lib/librte_eal/include/rte_log.h
+++ b/lib/librte_eal/include/rte_log.h
@@ -392,6 +392,7 @@ RTE_INIT(__##type)							\
 {									\
 	type = rte_log_register_type_and_pick_level(RTE_STR(name),	\
 						    RTE_LOG_##level);	\
+	type = RTE_MAX(0, type);                                        \
 }
 
 #ifdef __cplusplus
-- 
2.30.1



More information about the dev mailing list