log: choose EAL log type on registration failure
authorThomas Monjalon <thomas@monjalon.net>
Tue, 6 Apr 2021 13:22:02 +0000 (15:22 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 8 Apr 2021 16:31:58 +0000 (18:31 +0200)
In the unlikely case where something goes wrong
while registering a log type,
the fallback is to use the EAL log type.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
lib/librte_eal/include/rte_log.h

index 173004f..21a7d16 100644 (file)
@@ -380,6 +380,8 @@ RTE_INIT(__##type)                                                  \
 {                                                                      \
        type = rte_log_register_type_and_pick_level(RTE_STR(name),      \
                                                    RTE_LOG_##level);   \
+       if (type < 0)                                                   \
+               type = RTE_LOGTYPE_EAL;                                 \
 }
 
 #ifdef __cplusplus