mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src
@ 2022-06-10 16:50 Uwe Kleine-König
  2022-06-10 17:34 ` Ahmad Fatoum
  2022-06-14  8:50 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-10 16:50 UTC (permalink / raw)
  To: barebox; +Cc: Jürgen Borleis

Callers of *_get_boot_source (e.g. start_atf() of
nxp-imx8mm-evk or protonic-imx8m) expect src to hold the bootsource
after return. So assign a value also for the "unknown" case.

Fixes: ea55770308c0 ("ARM: i.MX: Add i.MX7 base architecture support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-imx/boot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 63afdf1ef4ed..1b0bccb7fed8 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -285,6 +285,8 @@ void imx53_get_boot_source(enum bootsource *src, int *instance)
 	default:
 		if (imx53_bootsource_nand(cfg1))
 			*src = BOOTSOURCE_NAND;
+		else
+			*src = BOOTSOURCE_UNKNOWN;
 		break;
 	}
 
@@ -464,6 +466,8 @@ void imx6_get_boot_source(enum bootsource *src, int *instance)
 	default:
 		if (imx53_bootsource_nand(bootmode))
 			*src = BOOTSOURCE_NAND;
+		else
+			*src = BOOTSOURCE_UNKNOWN;
 		break;
 	}
 }
@@ -526,6 +530,7 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
 		*src = BOOTSOURCE_SERIAL;
 		break;
 	default:
+		*src = BOOTSOURCE_UNKNOWN;
 		break;
 	}
 }
@@ -629,6 +634,8 @@ void vf610_get_boot_source(enum bootsource *src, int *instance)
 	default:
 		if (imx53_bootsource_nand(sbmr1))
 			*src = BOOTSOURCE_NAND;
+		else
+			*src = BOOTSOURCE_UNKNOWN;
 		break;
 	}
 }

base-commit: 345ef59aa0ea1a931629187449f63876501752cd
-- 
2.36.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src
  2022-06-10 16:50 [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src Uwe Kleine-König
@ 2022-06-10 17:34 ` Ahmad Fatoum
  2022-06-10 20:41   ` Uwe Kleine-König
  2022-06-14  8:50 ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2022-06-10 17:34 UTC (permalink / raw)
  To: Uwe Kleine-König, barebox; +Cc: Jürgen Borleis

On 10.06.22 18:50, Uwe Kleine-König wrote:
> Callers of *_get_boot_source (e.g. start_atf() of
> nxp-imx8mm-evk or protonic-imx8m) expect src to hold the bootsource
> after return. So assign a value also for the "unknown" case.

Did you check existing in-tree users to make sure none assigned
a different fallback value and assumed it won't be overwritten
if no bootsource could be found?

> 
> Fixes: ea55770308c0 ("ARM: i.MX: Add i.MX7 base architecture support")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/mach-imx/boot.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> index 63afdf1ef4ed..1b0bccb7fed8 100644
> --- a/arch/arm/mach-imx/boot.c
> +++ b/arch/arm/mach-imx/boot.c
> @@ -285,6 +285,8 @@ void imx53_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(cfg1))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  
> @@ -464,6 +466,8 @@ void imx6_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(bootmode))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> @@ -526,6 +530,7 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
>  		*src = BOOTSOURCE_SERIAL;
>  		break;
>  	default:
> +		*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> @@ -629,6 +634,8 @@ void vf610_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(sbmr1))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> 
> base-commit: 345ef59aa0ea1a931629187449f63876501752cd


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src
  2022-06-10 17:34 ` Ahmad Fatoum
@ 2022-06-10 20:41   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-10 20:41 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Jürgen Borleis


[-- Attachment #1.1: Type: text/plain, Size: 822 bytes --]

Hey Ahmad,

On Fri, Jun 10, 2022 at 07:34:49PM +0200, Ahmad Fatoum wrote:
> On 10.06.22 18:50, Uwe Kleine-König wrote:
> > Callers of *_get_boot_source (e.g. start_atf() of
> > nxp-imx8mm-evk or protonic-imx8m) expect src to hold the bootsource
> > after return. So assign a value also for the "unknown" case.
> 
> Did you check existing in-tree users to make sure none assigned
> a different fallback value and assumed it won't be overwritten
> if no bootsource could be found?

I checked that now as of 345ef59aa0ea:

There are ten users, 3 of them initialize src to BOOTSOURCE_UNKNOWN, the
other 7 don't initialize at all.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src
  2022-06-10 16:50 [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src Uwe Kleine-König
  2022-06-10 17:34 ` Ahmad Fatoum
@ 2022-06-14  8:50 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-06-14  8:50 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Jürgen Borleis

On Fri, Jun 10, 2022 at 06:50:57PM +0200, Uwe Kleine-König wrote:
> Callers of *_get_boot_source (e.g. start_atf() of
> nxp-imx8mm-evk or protonic-imx8m) expect src to hold the bootsource
> after return. So assign a value also for the "unknown" case.
> 
> Fixes: ea55770308c0 ("ARM: i.MX: Add i.MX7 base architecture support")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/mach-imx/boot.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> index 63afdf1ef4ed..1b0bccb7fed8 100644
> --- a/arch/arm/mach-imx/boot.c
> +++ b/arch/arm/mach-imx/boot.c
> @@ -285,6 +285,8 @@ void imx53_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(cfg1))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  
> @@ -464,6 +466,8 @@ void imx6_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(bootmode))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> @@ -526,6 +530,7 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
>  		*src = BOOTSOURCE_SERIAL;
>  		break;
>  	default:
> +		*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> @@ -629,6 +634,8 @@ void vf610_get_boot_source(enum bootsource *src, int *instance)
>  	default:
>  		if (imx53_bootsource_nand(sbmr1))
>  			*src = BOOTSOURCE_NAND;
> +		else
> +			*src = BOOTSOURCE_UNKNOWN;
>  		break;
>  	}
>  }
> 
> base-commit: 345ef59aa0ea1a931629187449f63876501752cd
> -- 
> 2.36.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2022-06-14  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 16:50 [PATCH] ARM: i.MX: Make sure *_get_boot_source always assignes *src Uwe Kleine-König
2022-06-10 17:34 ` Ahmad Fatoum
2022-06-10 20:41   ` Uwe Kleine-König
2022-06-14  8:50 ` Sascha Hauer

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