On Sun, 1 Sep 2024 03:54:54 +0300 Michael Guralnik <michaelgur@xxxxxxxxxx> wrote: Suggest these minor changes. > +static const char *event_type_to_str(uint8_t etype) > +{ > + static const char *const event_types_str[] = { "[REGISTER]", > + "[UNREGISTER]", > + "[NETDEV_ATTACH]", > + "[NETDEV_DETACH]" }; Break array initialization into: static const char *const event_types_str[] = { "[REGISTER]", "[UNREGISTER]" > + if (etype < ARRAY_SIZE(event_types_str)) > + return event_types_str[etype]; > + > + return "[UNKNOWN]"; Might be useful to use snprintf to static buffer and print the hex value for unknown events. > +}