diff mbox series

[v2,1/3] log: choose EAL log type on registration failure

Message ID 20210405100301.657768-2-thomas@monjalon.net (mailing list archive)
State Superseded
Delegated to: David Marchand
Headers show
Series drivers: align log names | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon April 5, 2021, 10:02 a.m. UTC
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@monjalon.net>
---
 lib/librte_eal/include/rte_log.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Marchand April 6, 2021, 9:17 a.m. UTC | #1
On Mon, Apr 5, 2021 at 12:03 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 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.

How about simply:
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>
Thomas Monjalon April 6, 2021, 9:49 a.m. UTC | #2
06/04/2021 11:17, David Marchand:
> On Mon, Apr 5, 2021 at 12:03 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 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.
> 
> How about simply:
> the fallback is to use the EAL log type.

OK, no need to mention 0.

> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
> 
>
diff mbox series

Patch

diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h
index 173004fd71..21a7d16340 100644
--- a/lib/librte_eal/include/rte_log.h
+++ b/lib/librte_eal/include/rte_log.h
@@ -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