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...
> + buffer, flags); > + if (ret) > + return ret; > + } > + > + return 0; > +} regards, dan carpenter