mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
sandbox: cros_ec: Only write EC state when the EC is probed
This can crash if the EC has not yet been probed. Add a check to prevent this. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5d8c37910d
commit
a5bc9abcee
@ -153,10 +153,14 @@ static int cros_ec_write_state(void *blob, int node)
|
|||||||
{
|
{
|
||||||
struct ec_state *ec = g_state;
|
struct ec_state *ec = g_state;
|
||||||
|
|
||||||
|
if (!g_state)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* We are guaranteed enough space to write basic properties */
|
/* We are guaranteed enough space to write basic properties */
|
||||||
fdt_setprop_u32(blob, node, "current-image", ec->current_image);
|
fdt_setprop_u32(blob, node, "current-image", ec->current_image);
|
||||||
fdt_setprop(blob, node, "vbnv-context", ec->vbnv_context,
|
fdt_setprop(blob, node, "vbnv-context", ec->vbnv_context,
|
||||||
sizeof(ec->vbnv_context));
|
sizeof(ec->vbnv_context));
|
||||||
|
|
||||||
return state_setprop(node, "flash-data", ec->flash_data,
|
return state_setprop(node, "flash-data", ec->flash_data,
|
||||||
ec->ec_config.flash.length);
|
ec->ec_config.flash.length);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user