[PATCH 2/9] Nokia RX-51: Do not clear unknown memory in lowlevel_init.S

Pali Rohár
2022-09-04T01:30:12Z

If kernel image in uImage or zImage format is not detected by
lowlevel_init.S code then do not clear memory location where image was
expected. If image is not detected then this memory region is unknown.
So do not unconditionally clear it.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
board/nokia/rx51/lowlevel_init.S | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S
index 53697fd4e125..1cf8f8d8b2f7 100644
--- a/board/nokia/rx51/lowlevel_init.S
+++ b/board/nokia/rx51/lowlevel_init.S
@@ -76,7 +76,7 @@ save_boot_params:
ldr r4, [r0, #36] /* r4 - 4 bytes header of kernel at offset 36 */
ldr r5, z_magic /* r5 - LINUX_ARM_ZIMAGE_MAGIC */
cmp r4, r5
- bne copy_kernel_end /* skip if invalid image */
+ bne skip_copy /* skip if invalid image */

copy_kernel_loop:
ldmdb r1!, {r3 - r10}
@@ -84,12 +84,12 @@ copy_kernel_loop:
cmp r1, r0
bhi copy_kernel_loop

-copy_kernel_end:
-
/* remove header in source kernel image */
mov r5, #0
str r5, [r0] /* remove 4 bytes header of kernel uImage */
str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */

+skip_copy:
+
/* Returns */
b save_boot_params_ret
--
2.20.1