Skip to content

Commit ee320b3

Browse files
arndbrobherring
authored andcommitted
of: fix uninitialized variable warning for overlay test
gcc warns that an empty device tree would cause undefined behavior: drivers/of/unittest.c: In function 'of_unittest': drivers/of/unittest.c:2199:25: warning: 'last_sibling' may be used uninitialized in this function [-Wmaybe-uninitialized] This adds an initialization of the variable to zero, which we handle correctly. Fixes: 81d0848 ("of: Add unit tests for applying overlays") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent 5d4dd65 commit ee320b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/of/unittest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ static __init void of_unittest_overlay_high_level(void)
21922192

21932193
mutex_lock(&of_mutex);
21942194

2195-
for (np = of_root->child; np; np = np->sibling)
2195+
for (last_sibling = np = of_root->child; np; np = np->sibling)
21962196
last_sibling = np;
21972197

21982198
if (last_sibling)

0 commit comments

Comments
 (0)