Skip to content

Commit 221a819

Browse files
bebarinorobherring
authored andcommitted
um: Unconditionally call unflatten_device_tree()
Call this function unconditionally so that we can populate an empty DTB on platforms that don't boot with a command line provided DTB. There's no harm in calling unflatten_device_tree() unconditionally. If there isn't a valid initial_boot_params dtb then unflatten_device_tree() returns early. Cc: Rob Herring <[email protected]> Cc: Frank Rowand <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Johannes Berg <[email protected]> Cc: [email protected] Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 7b937cc commit 221a819

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

arch/um/kernel/dtb.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ void uml_dtb_init(void)
1616
void *area;
1717

1818
area = uml_load_file(dtb, &size);
19-
if (!area)
20-
return;
21-
22-
if (!early_init_dt_scan(area)) {
23-
pr_err("invalid DTB %s\n", dtb);
24-
memblock_free(area, size);
25-
return;
19+
if (area) {
20+
if (!early_init_dt_scan(area)) {
21+
pr_err("invalid DTB %s\n", dtb);
22+
memblock_free(area, size);
23+
return;
24+
}
25+
26+
early_init_fdt_scan_reserved_mem();
2627
}
2728

28-
early_init_fdt_scan_reserved_mem();
2929
unflatten_device_tree();
3030
}
3131

drivers/of/unittest.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,10 +4087,6 @@ static int __init of_unittest(void)
40874087
add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
40884088

40894089
/* adding data for unittest */
4090-
4091-
if (IS_ENABLED(CONFIG_UML))
4092-
unittest_unflatten_overlay_base();
4093-
40944090
res = unittest_data_add();
40954091
if (res)
40964092
return res;

0 commit comments

Comments
 (0)