Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2017 19:15:57 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315019 - head/sys/boot/fdt
Message-ID:  <201703101915.v2AJFv2V099467@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Fri Mar 10 19:15:57 2017
New Revision: 315019
URL: https://svnweb.freebsd.org/changeset/base/315019

Log:
  [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

Modified:
  head/sys/boot/fdt/fdt_overlay.c

Modified: head/sys/boot/fdt/fdt_overlay.c
==============================================================================
--- head/sys/boot/fdt/fdt_overlay.c	Fri Mar 10 19:13:38 2017	(r315018)
+++ head/sys/boot/fdt/fdt_overlay.c	Fri Mar 10 19:15:57 2017	(r315019)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703101915.v2AJFv2V099467>