Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 May 2017 00:29:29 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r317994 - stable/11/sys/boot/fdt
Message-ID:  <201705090029.v490TTa9034046@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Tue May  9 00:29:29 2017
New Revision: 317994
URL: https://svnweb.freebsd.org/changeset/base/317994

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

Modified:
  stable/11/sys/boot/fdt/fdt_overlay.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/fdt/fdt_overlay.c
==============================================================================
--- stable/11/sys/boot/fdt/fdt_overlay.c	Mon May  8 23:57:54 2017	(r317993)
+++ stable/11/sys/boot/fdt/fdt_overlay.c	Tue May  9 00:29:29 2017	(r317994)
@@ -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?201705090029.v490TTa9034046>