Skip to content

Commit 2438dbb

Browse files
barnas-michalfabiobaltieri
authored andcommitted
init: add missing initialization of dev pointer in SYS_INIT macro
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]>
1 parent 2c70c5d commit 2438dbb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/zephyr/init.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ struct init_entry {
202202
*
203203
* @see SYS_INIT()
204204
*/
205-
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
206-
static const Z_DECL_ALIGN(struct init_entry) \
207-
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
208-
Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
205+
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
206+
static const Z_DECL_ALIGN(struct init_entry) \
207+
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
208+
Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, .dev = NULL}
209209

210210
/** @} */
211211

0 commit comments

Comments
 (0)