]> git.sur5r.net Git - u-boot/commitdiff
cmd/onenand.c: block align warning
authorLadislav Michl <ladis@linux-mips.org>
Tue, 13 Sep 2016 05:40:00 +0000 (07:40 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 7 Oct 2016 00:57:42 +0000 (20:57 -0400)
An attempt to write non block aligned data fails silently, add warning and
set result.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
cmd/onenand.c

index feab01a71e3d3f77b1e66dfa26a9faa660a50d63..d97844fa7a3823e01d4d45417a9ec81b871f1e34 100644 (file)
@@ -139,6 +139,12 @@ static int onenand_block_write(loff_t to, size_t len,
        size_t _retlen = 0;
        int ret;
 
+       if ((to & (mtd->writesize - 1)) != 0) {
+               printf("Attempt to write non block-aligned data\n");
+               *retlen = 0;
+               return 1;
+       }
+
        if (to == next_ofs) {
                next_ofs = to + len;
                to += skip_ofs;