arm64: zynqmp: Enables SPI_FLASH_BAR
[oweals/u-boot.git] / common / bootstage.c
index b1d4ee84e7ef0a92db57f4fbecc9cd337aa144d8..56ef91ad85995dde2addef0be43694e4ed3813f6 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2011, Google Inc. All rights reserved.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 
@@ -100,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++;