[RFC PATCH v2 2/2] board: ad401: example of fastboot oem board realization
Alexey Romanov
avromanov at salutedevices.com
Thu Feb 1 15:54:04 CET 2024
Hi,
On Thu, Feb 01, 2024 at 04:56:34PM +0300, Dan Carpenter wrote:
> On Thu, Feb 01, 2024 at 12:20:27PM +0300, Alexey Romanov wrote:
> > +static int fastboot_nand_write_tpl(struct mtd_info *mtd, void *buffer,
> > + u32 offset, size_t size, int flags)
> > +{
> > + int boot_cpy_num = meson_bootloader_copy_num(BOOT_TPL);
> > + u64 size_per_copy = meson_bootloader_copy_size(mtd, BOOT_TPL);
> > + int i;
> > +
> > + for (i = 0; i < boot_cpy_num; i++) {
> > + size_t retlen, len = size;
> > + int ret;
> > +
> > + ret = nand_write_skip_bad(mtd, offset + (i * size_per_copy),
> > + &len, &retlen, offset + size_per_copy,
> ^^^^^^^^^^^^^^^^^^^^^^
> Sorry if I'm missing something obvious, but why is the limit
> "offset + size_per_copy"? I would have expected it to be just
> "size_per_copy" or maybe some kind of limit minus the offset...
Yeah, this is incorrect. Should be size_per_copy.
But this patch is just an example of realization.
>
> > + buffer, flags);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > + return 0;
> > +}
>
> regards,
> dan carpenter
>
--
Thank you,
Alexey
More information about the U-Boot
mailing list