Skip to content

Commit

Permalink
init: add missing initialization of dev pointer in SYS_INIT macro
Browse files Browse the repository at this point in the history
When the -Werror=missing-field-initializers is enabled, the compiler
complains about missing initialization of dev pointer in the
init_entry struct when using the SYS_INIT[_NAMED] macro.
This commit adds explicit assignment of NULL to it.

Signed-off-by: Michał Barnaś <[email protected]>
  • Loading branch information
barnas-michal authored and fabiobaltieri committed Jan 19, 2024
1 parent 2c70c5d commit 2438dbb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/zephyr/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ struct init_entry {
*
* @see SYS_INIT()
*/
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
static const Z_DECL_ALIGN(struct init_entry) \
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
static const Z_DECL_ALIGN(struct init_entry) \
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, .dev = NULL}

/** @} */

Expand Down

0 comments on commit 2438dbb

Please sign in to comment.