public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization
@ 2011-07-28  9:04 Igor Grinberg
  2011-07-29  3:53 ` Chander Kashyap
  2011-08-12  9:20 ` Albert ARIBAUD
  0 siblings, 2 replies; 6+ messages in thread
From: Igor Grinberg @ 2011-07-28  9:04 UTC (permalink / raw)
  To: u-boot

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 |    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();
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization
  2011-07-28  9:04 [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization Igor Grinberg
@ 2011-07-29  3:53 ` Chander Kashyap
  2011-08-12  9:20 ` Albert ARIBAUD
  1 sibling, 0 replies; 6+ messages in thread
From: Chander Kashyap @ 2011-07-29  3:53 UTC (permalink / raw)
  To: u-boot

On 28 July 2011 14:34, Igor Grinberg <grinberg@compulab.co.il> wrote:
> 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>
tested-by: Chander Kashyap <chander.kashyap@linaro.org>
> ---
> ?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();
> --
> 1.7.3.4
>
>



-- 
with warm regards,
Chander Kashyap

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization
  2011-07-28  9:04 [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization Igor Grinberg
  2011-07-29  3:53 ` Chander Kashyap
@ 2011-08-12  9:20 ` Albert ARIBAUD
  2011-08-17  9:43   ` Igor Grinberg
  2011-08-17  9:48   ` [U-Boot] [PATCH v2] " Igor Grinberg
  1 sibling, 2 replies; 6+ messages in thread
From: Albert ARIBAUD @ 2011-08-12  9:20 UTC (permalink / raw)
  To: u-boot

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<grinberg@compulab.co.il>
> ---
>   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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization
  2011-08-12  9:20 ` Albert ARIBAUD
@ 2011-08-17  9:43   ` Igor Grinberg
  2011-08-17  9:48   ` [U-Boot] [PATCH v2] " Igor Grinberg
  1 sibling, 0 replies; 6+ messages in thread
From: Igor Grinberg @ 2011-08-17  9:43 UTC (permalink / raw)
  To: u-boot

Hi Albert,

Sorry for the poor responsiveness - I was out of office for about 2 weeks.


On 08/12/11 12:20, Albert ARIBAUD wrote:
> 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<grinberg@compulab.co.il>
>> ---
>>   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.

Well, it applied cleanly for me...
Nevertheless, I'm sending a v2 rebased on top of the most recent u-boot-arm/master
with your requested change.


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] arm: fix bd pointer dereference prior initialization
  2011-08-12  9:20 ` Albert ARIBAUD
  2011-08-17  9:43   ` Igor Grinberg
@ 2011-08-17  9:48   ` Igor Grinberg
  2011-08-17 16:13     ` Albert ARIBAUD
  1 sibling, 1 reply; 6+ messages in thread
From: Igor Grinberg @ 2011-08-17  9:48 UTC (permalink / raw)
  To: u-boot

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>
---
v2:	move it closer to the bd pointer set up as for Albert's suggestion.

 arch/arm/lib/board.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 646cf45..c899839 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -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",
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] arm: fix bd pointer dereference prior initialization
  2011-08-17  9:48   ` [U-Boot] [PATCH v2] " Igor Grinberg
@ 2011-08-17 16:13     ` Albert ARIBAUD
  0 siblings, 0 replies; 6+ messages in thread
From: Albert ARIBAUD @ 2011-08-17 16:13 UTC (permalink / raw)
  To: u-boot

Hi Igor,

Le 17/08/2011 11:48, Igor Grinberg a ?crit :
> 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>
> ---
> v2:	move it closer to the bd pointer set up as for Albert's suggestion.
>
>   arch/arm/lib/board.c |    9 +++++----
>   1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 646cf45..c899839 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -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",

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-17 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-28  9:04 [U-Boot] [PATCH] arm: fix bd pointer dereference prior initialization Igor Grinberg
2011-07-29  3:53 ` Chander Kashyap
2011-08-12  9:20 ` Albert ARIBAUD
2011-08-17  9:43   ` Igor Grinberg
2011-08-17  9:48   ` [U-Boot] [PATCH v2] " Igor Grinberg
2011-08-17 16:13     ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox