[PATCH 2/3] ARM: i.MX: bbu-internal: new handler to make use of mmc boot partitions
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Mon Oct 23 00:54:33 PDT 2017
On Mon, Oct 23, 2017 at 09:20:36AM +0200, Sascha Hauer wrote:
> On Wed, Oct 18, 2017 at 03:41:16PM +0200, Uwe Kleine-König wrote:
> > From: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> >
> > This handler updates the non-active MMC boot partition and after a
> > successful update makes the updated partition the active one. This way
> > the machine should continue to be bootable when the update fails.
>
> Adding something like this as a comment above
> imx6_bbu_internal_mmcboot_register_handler() would be nice.
ok.
> > +static int imx_bbu_internal_v2_mmcboot_update(struct bbu_handler *handler,
> > + struct bbu_data *data)
> > +{
> > + struct imx_internal_bbu_handler *imx_handler =
> > + container_of(handler, struct imx_internal_bbu_handler, handler);
> > + int ret;
> > + uint32_t *barker;
> > + char *bootpartvar;
> > + const char *bootpart;
> > + char *devicefile;
> > +
> > + barker = data->image + imx_handler->flash_header_offset;
> > +
> > + if (*barker != IVT_BARKER) {
> > + printf("Board does not provide DCD data and this image is no imximage\n");
> > + return -EINVAL;
> > + }
> > +
> > + ret = asprintf(&bootpartvar, "%s.boot", data->devicefile);
> > + if (ret < 0) {
> > + printf("Failed to allocate string for boot variable\n");
>
> I think messages for failed memory allocations which eat more space than
> the actual allocation should be avoided. Just return -ENOMEM without a
> message.
In general not giving an error message makes the problem harder to
locate. But maybe if I'm unable to allocate 20 Bytes the problem is
obvious.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the barebox
mailing list