diff --git a/arch/arm/boards/highbank/init.c b/arch/arm/boards/highbank/init.c index 1cb02e6..295d475 100644 --- a/arch/arm/boards/highbank/init.c +++ b/arch/arm/boards/highbank/init.c @@ -77,7 +77,7 @@ fdt = IOMEM(FIRMWARE_DTB_BASE); root = of_unflatten_dtb(fdt); - if (!root) { + if (IS_ERR(root)) { pr_warn("no dtb found at 0x1000 use default configuration\n"); fdt = NULL; goto not_found; diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c index ae4ff2a..b9390b4 100644 --- a/arch/arm/cpu/dtb.c +++ b/arch/arm/cpu/dtb.c @@ -48,7 +48,7 @@ } root = of_unflatten_dtb(fdt); - if (root) { + if (!IS_ERR(root)) { of_set_root_node(root); of_fix_tree(root); if (IS_ENABLED(CONFIG_OFDEVICE)) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 404a6ae..56663fe 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -267,7 +267,7 @@ if (IS_BUILTIN(CONFIG_OFTREE)) { data->of_root_node = of_unflatten_dtb(oftree); - if (!data->of_root_node) { + if (IS_ERR(data->of_root_node)) { pr_err("unable to unflatten devicetree\n"); ret = -EINVAL; goto err_free; diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c index 977c837..e7633a5 100644 --- a/arch/mips/boot/dtb.c +++ b/arch/mips/boot/dtb.c @@ -51,7 +51,7 @@ return 0; root = of_unflatten_dtb(__dtb_start); - if (root) { + if (!IS_ERR(root)) { pr_debug("using internal DTB\n"); of_set_root_node(root); if (IS_ENABLED(CONFIG_OFDEVICE)) diff --git a/arch/openrisc/lib/dtb.c b/arch/openrisc/lib/dtb.c index 4f63a77..04bb6d2 100644 --- a/arch/openrisc/lib/dtb.c +++ b/arch/openrisc/lib/dtb.c @@ -32,7 +32,7 @@ return 0; root = of_unflatten_dtb(__dtb_start); - if (root) { + if (!IS_ERR(root)) { pr_debug("using internal DTB\n"); of_set_root_node(root); if (IS_ENABLED(CONFIG_OFDEVICE)) diff --git a/common/bootm.c b/common/bootm.c index 78d04d5..5984319 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -336,6 +336,9 @@ if (data->os_fit && data->os_fit->oftree) { data->of_root_node = of_unflatten_dtb(data->os_fit->oftree); + + if (IS_ERR(data->of_root_node)) + data->of_root_node = NULL; } else if (data->oftree_file) { size_t size; @@ -367,7 +370,8 @@ free(oftree); - if (!data->of_root_node) { + if (IS_ERR(data->of_root_node)) { + data->of_root_node = NULL; pr_err("unable to unflatten devicetree\n"); return -EINVAL; }