mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/3] ARM: i.MX: bbu-internal: new handler to make use of mmc boot partitions
Date: Mon, 23 Oct 2017 09:54:33 +0200	[thread overview]
Message-ID: <20171023075433.tfhz5odczkrlbyrd@pengutronix.de> (raw)
In-Reply-To: <20171023072036.23nneaapd7orpopv@pengutronix.de>

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@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/  |

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

  reply	other threads:[~2017-10-23  7:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 13:41 [PATCH 1/3] ARM: i.MX: bbu-internal: make filename for device to write to adaptable Uwe Kleine-König
2017-10-18 13:41 ` [PATCH 2/3] ARM: i.MX: bbu-internal: new handler to make use of mmc boot partitions Uwe Kleine-König
2017-10-23  7:20   ` Sascha Hauer
2017-10-23  7:54     ` Uwe Kleine-König [this message]
2017-10-18 13:41 ` [PATCH 3/3] ARM: i.MX: bbu-internal: update board files to make use of new bbu handler Uwe Kleine-König
2017-10-23  7:23   ` Sascha Hauer
2017-10-23  7:55     ` Uwe Kleine-König
2017-10-23  8:05       ` 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=20171023075433.tfhz5odczkrlbyrd@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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