From da1f91422c2e3479066e22cc2795b7927dfe6714 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 1 Sep 2016 13:39:58 -0700 Subject: of_unflatten_dtb(): Check return value with IS_ERR Of_unflatten_dtb returns a ERR_PTR value so checking it against NULL is incorrect. Fix it in all of the places where this was happening. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/bootm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/bootm.c') diff --git a/common/bootm.c b/common/bootm.c index 78d04d5806..59843195cd 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -336,6 +336,9 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address) 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 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address) 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; } -- cgit v1.2.3