Skip to content

Commit

Permalink
of/fdt: Don't clear initial_boot_params if fdt_check_header() fails
Browse files Browse the repository at this point in the history
If the device tree pointer is NULL, early_init_dt_verify() fails, leaving
initial_boot_params unchanged.  If the device tree pointer is non-NULL but
invalid, early_init_dt_verify() again fails but this time it also clears
initial_boot_params.

Leave initial_boot_params unchanged if the device tree pointer is invalid.
This doesn't fix a bug, but it makes the behavior more consistent and
easier to analyze.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
bjorn-helgaas authored and glikely committed Nov 4, 2014
1 parent b75b276 commit 50ba08f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,15 +992,12 @@ bool __init early_init_dt_verify(void *params)
if (!params)
return false;

/* Setup flat device-tree pointer */
initial_boot_params = params;

/* check device tree validity */
if (fdt_check_header(params)) {
initial_boot_params = NULL;
if (fdt_check_header(params))
return false;
}

/* Setup flat device-tree pointer */
initial_boot_params = params;
return true;
}

Expand Down

0 comments on commit 50ba08f

Please sign in to comment.