1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-06 18:29:47 +00:00

[loader][fdt] Fix applying overlays without __local_fixups__ node

Do not return error if __local_fixups__ node is missing in DTB overlay
because local fixup data is optional.

Reported by:	Manuel Stuhn
MFC after:	1 week
This commit is contained in:
Oleksandr Tymoshenko 2017-03-10 19:15:57 +00:00
parent 7554e75851
commit 947d877109
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315019

View File

@ -358,21 +358,26 @@ static int
fdt_overlay_do_local_fixups(void *main_fdtp, void *overlay_fdtp)
{
int overlay_local_fixups_o;
int len;
int len, rv;
const char *fixups;
uint32_t phandle_offset;
overlay_local_fixups_o = fdt_path_offset(overlay_fdtp, "/__local_fixups__");
if (overlay_local_fixups_o < 0)
return (-1);
if (overlay_local_fixups_o < 0) {
/* If not local fixups - do nothing */
if (overlay_local_fixups_o == -FDT_ERR_NOTFOUND)
return (0);
return (overlay_local_fixups_o);
}
phandle_offset = fdt_max_phandle(main_fdtp);
fdt_increase_phandles(overlay_fdtp, phandle_offset);
fixups = fdt_getprop_w(overlay_fdtp, overlay_local_fixups_o, "fixup", &len);
if (fixups) {
if (fdt_do_local_fixup(overlay_fdtp, fixups, len, phandle_offset) < 0)
return (-1);
rv = fdt_do_local_fixup(overlay_fdtp, fixups, len, phandle_offset);
if (rv < 0)
return (rv);
}
return (0);