diff options
author | Simon Glass <sjg@chromium.org> | 2019-04-08 22:20:45 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-04-24 05:26:43 +0300 |
commit | 173577252f2bebaf17851ce8128ba522f27fb6dd (patch) | |
tree | c9b27031067f07832d46f1a8e7242acb583b0c73 /common/bootstage.c | |
parent | a1396cdc4b557ac678b7af93938e58814612759a (diff) | |
download | u-boot-173577252f2bebaf17851ce8128ba522f27fb6dd.tar.xz |
bootstage: Allow calling bootstage_mark() before bootstage_init()
It is possible for this to happen if something goes wrong very early in
the init sequence. Add a check for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/bootstage.c')
-rw-r--r-- | common/bootstage.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/bootstage.c b/common/bootstage.c index 9793b85d4e..56ef91ad85 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -99,6 +99,13 @@ ulong bootstage_add_record(enum bootstage_id id, const char *name, struct bootstage_data *data = gd->bootstage; struct bootstage_record *rec; + /* + * initf_bootstage() is called very early during boot but since hang() + * calls bootstage_error() we can be called before bootstage is set up. + * Add a check to avoid this. + */ + if (!data) + return mark; if (flags & BOOTSTAGEF_ALLOC) id = data->next_id++; |