[PATCH] ARM: i.MX7/8M: Make sure the output parameter is always assigned
Sascha Hauer
sha at pengutronix.de
Fri Jun 10 00:44:06 PDT 2022
On Fri, Jun 10, 2022 at 09:28:54AM +0200, Jürgen Borleis wrote:
> Am Freitag, 10. Juni 2022, 09:05:57 CEST schrieb Uwe Kleine-König:
> > 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 reliably.
> >
> > Fixes: ea55770308c0 ("ARM: i.MX: Add i.MX7 base architecture support")
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> > ---
> > arch/arm/mach-imx/boot.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> > index 63afdf1ef4ed..652e2869f2d7 100644
> > --- a/arch/arm/mach-imx/boot.c
> > +++ b/arch/arm/mach-imx/boot.c
> > @@ -526,6 +526,7 @@ static void __imx7_get_boot_source(enum bootsource *src,
> > int *instance, *src = BOOTSOURCE_SERIAL;
> > break;
> > default:
> > + *src = BOOTSOURCE_UNKNOWN;
> > break;
> > }
> > }
>
> This changes the API and - if really required - should be done for all SoC
> specific *_get_boot_sources and not for the imx7 only (IMHO).
How does that change the API? It just makes sure that *src is
initialized in all cases. I found at least one case where a caller
continues with a potentially uninitialzed value.
This happens only when __imx7_get_boot_source() is called from board
code. Normally it's called via imx_boot_save_loc() which initializes
*src to BOOTSOURCE_UNKNOWN before calling into __imx7_get_boot_source().
Sascha
--
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 |
More information about the barebox
mailing list