mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Jürgen Borleis" <jbe@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: i.MX7/8M: Make sure the output parameter is always assigned
Date: Fri, 10 Jun 2022 10:49:02 +0200	[thread overview]
Message-ID: <20220610084902.GK1615@pengutronix.de> (raw)
In-Reply-To: <20220610084209.5aq3vtx3u3vyjimt@pengutronix.de>

On Fri, Jun 10, 2022 at 10:42:09AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> 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@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
> 
> I agree to sha here. Callers seem to expect *src to be initialised
> always.
> 
> > and - if really required - should be done for all SoC 
> > specific *_get_boot_sources and not for the imx7 only (IMHO).
> 
> Agreed, that would be
> 
> diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> index 63afdf1ef4ed..c0608c6a8e1b 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;
>  	}
>  }
> 
> then.
> 
> @sha: If wrote to have already applied my patch. If you drop it, I
> resend with the above diff and an adapted commit log.

Go ahead

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 |

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


  reply	other threads:[~2022-06-10  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  7:05 Uwe Kleine-König
2022-06-10  7:28 ` Jürgen Borleis
2022-06-10  7:44   ` Sascha Hauer
2022-06-10  8:42   ` Uwe Kleine-König
2022-06-10  8:49     ` Sascha Hauer [this message]
2022-06-10  7:51 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220610084902.GK1615@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox