Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: overlay: Move devicetree_corrupt() check up

There is no point in doing several preparatory steps in
of_overlay_fdt_apply(), only to see of_overlay_apply() return early
because of a corrupt device tree.

Move the check for a corrupt device tree from of_overlay_apply() to
of_overlay_fdt_apply(), to check for this as early as possible.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Tested-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/c91ce7112eb5167ea46a43d8a980e76b920010ba.1657893306.git.geert+renesas@glider.be

authored by

Geert Uytterhoeven and committed by
Rob Herring
e385b0ba 2aa0d4c8

+5 -6
+5 -6
drivers/of/overlay.c
··· 903 903 { 904 904 int ret = 0, ret_revert, ret_tmp; 905 905 906 - if (devicetree_corrupt()) { 907 - pr_err("devicetree state suspect, refuse to apply overlay\n"); 908 - ret = -EBUSY; 909 - goto out; 910 - } 911 - 912 906 ret = of_resolve_phandles(ovcs->overlay_root); 913 907 if (ret) 914 908 goto out; ··· 976 982 struct overlay_changeset *ovcs; 977 983 978 984 *ret_ovcs_id = 0; 985 + 986 + if (devicetree_corrupt()) { 987 + pr_err("devicetree state suspect, refuse to apply overlay\n"); 988 + return -EBUSY; 989 + } 979 990 980 991 if (overlay_fdt_size < sizeof(struct fdt_header) || 981 992 fdt_check_header(overlay_fdt)) {