Skip to contentSkip to conversation

MIPS: bootm: tiny fixes in do_bootm_elf()

PATCH Applied Denis Orlov 2 participants 5 messages Mar 15, 2023 – Mar 16, 2023 MIPS

lore
Share & tools
lore
#0 lore raw

cover MIPS: bootm: tiny fixes in do_bootm_elf()

Denis Orlov (3):
MIPS: bootm: do not free fdt pointer that contains an error
MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()
MIPS: bootm: remove unnecessary phys/virt conversions

 arch/mips/lib/bootm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/3 MIPS: bootm: do not free fdt pointer that contains an error

Also add a proper error message.

---
 arch/mips/lib/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/lib/bootm.c +2 -2
index 655535737e..95e9dc0d7d 100644
@@ -57,8 +57,8 @@ static int do_bootm_elf(struct image_data *data)
 
 	fdt = bootm_get_devicetree(data);
 	if (IS_ERR(fdt)) {
-		ret = PTR_ERR(fdt);
-		goto bootm_free_fdt;
+		pr_err("Failed to load dtb\n");
+		return PTR_ERR(fdt);
 	}
 
 	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/3 MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()

In reply to Denis Orlov
---
 arch/mips/lib/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/lib/bootm.c +1 -1
index 95e9dc0d7d..69ce9b3904 100644
@@ -69,7 +69,7 @@ static int do_bootm_elf(struct image_data *data)
 
 	ret = of_overlay_load_firmware();
 	if (ret)
-		return ret;
+		goto bootm_free_fdt;
 
 	shutdown_barebox();
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/3 MIPS: bootm: remove unnecessary phys/virt conversions

In reply to Denis Orlov

They are not doing anything there - we should already have proper virtual addresses represented by those pointers.

---
 arch/mips/lib/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/lib/bootm.c +2 -2
index 69ce9b3904..19d82ec375 100644
@@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
 	}
 
 	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
-		phys_to_virt(data->os_address), data->of_root_node);
+		data->os_address, data->of_root_node);
 
 	if (data->dryrun)
 		goto bootm_free_fdt;
@@ -75,7 +75,7 @@ static int do_bootm_elf(struct image_data *data)
 
 	entry = (void *) (unsigned long) data->os_address;
 
-	entry(-2, phys_to_virt((unsigned long)fdt));
+	entry(-2, fdt);
 
 	pr_err("ELF application terminated\n");
 	ret = -EINVAL;
Signature · 1 line
2.30.2
Applied
#4 lore raw
In reply to Denis Orlov
Quoted 7 lines · Denis Orlov

Denis Orlov (3):
MIPS: bootm: do not free fdt pointer that contains an error
MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()
MIPS: bootm: remove unnecessary phys/virt conversions

 arch/mips/lib/bootm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |