mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: rpi: Do not warn when firmware doesn't pass a dtb
@ 2019-12-19  4:48 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2019-12-19  4:48 UTC (permalink / raw)
  To: Barebox List

When there is no dtb placed in the boot partition then none is passed by
the firmware to barebox. This may be intended, so do not warn about it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/lowlevel.c   |  9 ++++++++-
 arch/arm/boards/raspberry-pi/rpi-common.c | 11 +++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 70f1936522..d58beb6052 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -11,8 +11,15 @@ static void copy_vc_fdt(void *dest, void *src, unsigned long max_size)
 {
 	struct fdt_header *oftree_src = src;
 	struct fdt_header *oftree_dest = dest;
+	unsigned long size;
 
-	unsigned long size = be32_to_cpu(oftree_src->totalsize);
+	if (!src) {
+		oftree_dest->magic = cpu_to_be32(VIDEOCORE_FDT_ERROR);
+		oftree_dest->totalsize = cpu_to_be32(0);
+		return;
+	}
+
+	size = be32_to_cpu(oftree_src->totalsize);
 	if (size > max_size) {
 		oftree_dest->magic = cpu_to_be32(VIDEOCORE_FDT_ERROR);
 		/* Save an error code after the magic value for easier
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index dd6bbd5bdd..acb26f6a64 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -433,13 +433,16 @@ static void rpi_vc_fdt(void)
 
 	oftree = saved_vc_fdt;
 	magic = be32_to_cpu(oftree->magic);
-	if (magic != FDT_MAGIC) {
-		pr_err("videocore fdt saved in pbl has invalid magic\n");
 
-		if (magic == VIDEOCORE_FDT_ERROR) {
+	if (magic == VIDEOCORE_FDT_ERROR) {
+		if (oftree->totalsize)
 			pr_err("there was an error copying fdt in pbl: %d\n",
 					be32_to_cpu(oftree->totalsize));
-		}
+		return;
+	}
+
+	if (magic != FDT_MAGIC) {
+		pr_err("videocore fdt saved in pbl has invalid magic\n");
 		return;
 	}
 
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-19  4:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19  4:48 [PATCH] ARM: rpi: Do not warn when firmware doesn't pass a dtb Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox