fdt_fixups: relocate the /chosen node after applying fixups
As indicated by the comment, any fixups applied (which might include overlays) can invalidate the previously located node by adding nodes or setting/adding properties. The later fdt_setprop of fixup-applied property would then fail because of the bad/wrong node offset. This would have generally been harmless, but potentially caused multiple applications of fixups and caused a little bit of bloat. MFC after: 1 week
This commit is contained in:
parent
b8bfcb71fd
commit
98d0335366
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338219
@ -933,6 +933,12 @@ fdt_fixup(void)
|
||||
|
||||
fdt_platform_fixups();
|
||||
|
||||
/*
|
||||
* Re-fetch the /chosen subnode; our fixups may apply overlays or add
|
||||
* nodes/properties that invalidate the offset we grabbed or created
|
||||
* above, so we can no longer trust it.
|
||||
*/
|
||||
chosen = fdt_subnode_offset(fdtp, 0, "chosen");
|
||||
fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0);
|
||||
return (1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user