Skip to content

Commit 7b432bf

Browse files
Oreoluwa Babatundestffrdhrn
authored andcommitted
openrisc: Call setup_memory() earlier in the init sequence
The unflatten_and_copy_device_tree() function contains a call to memblock_alloc(). This means that memblock is allocating memory before any of the reserved memory regions are set aside in the setup_memory() function which calls early_init_fdt_scan_reserved_mem(). Therefore, there is a possibility for memblock to allocate from any of the reserved memory regions. Hence, move the call to setup_memory() to be earlier in the init sequence so that the reserved memory regions are set aside before any allocations are done using memblock. Signed-off-by: Oreoluwa Babatunde <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent b401b62 commit 7b432bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/openrisc/kernel/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ void calibrate_delay(void)
255255

256256
void __init setup_arch(char **cmdline_p)
257257
{
258+
/* setup memblock allocator */
259+
setup_memory();
260+
258261
unflatten_and_copy_device_tree();
259262

260263
setup_cpuinfo();
@@ -278,9 +281,6 @@ void __init setup_arch(char **cmdline_p)
278281
}
279282
#endif
280283

281-
/* setup memblock allocator */
282-
setup_memory();
283-
284284
/* paging_init() sets up the MMU and marks all pages as reserved */
285285
paging_init();
286286

0 commit comments

Comments
 (0)