arm: fix bd pointer dereference prior initialization
authorIgor Grinberg <grinberg@compulab.co.il>
Tue, 16 Aug 2011 23:48:23 +0000 (23:48 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 3 Sep 2011 20:40:46 +0000 (22:40 +0200)
gd->bd pointer has been used prior been initialized.
Move the relevant code after the initialization.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
arch/arm/lib/board.c

index 646cf450f70d83ea774c023834cdaf3b9c364248..c899839852d9cf5ed4e0e4efd10a71ad4d4ac051 100644 (file)
@@ -275,10 +275,6 @@ void board_init_f(ulong bootflag)
 
        gd->mon_len = _bss_end_ofs;
 
-#ifdef CONFIG_MACH_TYPE
-       gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
-#endif
-
        for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
                if ((*init_fnc_ptr)() != 0) {
                        hang ();
@@ -376,6 +372,11 @@ void board_init_f(ulong bootflag)
        gd->bd = bd;
        debug("Reserving %zu Bytes for Board Info at: %08lx\n",
                        sizeof (bd_t), addr_sp);
+
+#ifdef CONFIG_MACH_TYPE
+       gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
+#endif
+
        addr_sp -= sizeof (gd_t);
        id = (gd_t *) addr_sp;
        debug("Reserving %zu Bytes for Global Data at: %08lx\n",