From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Fri, 12 Aug 2011 11:20:36 +0200 Subject: [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization In-Reply-To: <1311843846-27336-1-git-send-email-grinberg@compulab.co.il> References: <1311843846-27336-1-git-send-email-grinberg@compulab.co.il> Message-ID: <4E44F064.9080806@aribaud.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Igor, On 28/07/2011 11:04, Igor Grinberg wrote: > gd->bd pointer has been used prior been initialized. > Move the relevant code after the initialization. > > Signed-off-by: Igor Grinberg > --- > arch/arm/lib/board.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c > index bcbf697..52e90db 100644 > --- a/arch/arm/lib/board.c > +++ b/arch/arm/lib/board.c > @@ -281,10 +281,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 (); > @@ -409,6 +405,10 @@ void board_init_f (ulong bootflag) > post_run (NULL, POST_ROM | post_bootmode_get(0)); > #endif > > +#ifdef CONFIG_MACH_TYPE > + gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */ > +#endif > + > gd->bd->bi_baudrate = gd->baudrate; > /* Ram ist board specific, so move it to board code ... */ > dram_init_banksize(); As a bugfix, I'd like to pull this patch in now. However, it does not apply cleanly to current u-boot-arm/master, and besides, I'd rather have the bi_arch_number initialized as soon as bd is set up, i.e. just after the assignment to gd->bd. Amicalement, -- Albert.