Merge branch '2019-10-28-azure-ci-support'
[oweals/u-boot.git] / common / bootstage.c
index 9793b85d4e42d481e677639e8aa8210391379efd..56ef91ad85995dde2addef0be43694e4ed3813f6 100644 (file)
@@ -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++;