]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: rawnand: sunxi: sunxi_nand_ooblayout_free code clarification
authorRichard Genoud <richard.genoud@bootlin.com>
Tue, 17 Mar 2026 14:24:29 +0000 (15:24 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 25 Mar 2026 14:27:29 +0000 (15:27 +0100)
The available length is really USER_DATA_LEN - 2 instead of just 2 (the
user data length minus the BBM length)
USER_DATA_LEN being 4, that doesn't change anything now, but if
USER_DATA_LEN changes, it will.

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/sunxi_nand.c

index e66adfcca7cd63fb1117fd12ee69ec7329decc35..915f1240546f88af633db6694b40664e3aa9f27d 100644 (file)
@@ -1755,12 +1755,12 @@ static int sunxi_nand_ooblayout_free(struct mtd_info *mtd, int section,
 
        /*
         * The first 2 bytes are used for BB markers, hence we
-        * only have 2 bytes available in the first user data
+        * only have USER_DATA_SZ - 2 bytes available in the first user data
         * section.
         */
        if (!section && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
                oobregion->offset = 2;
-               oobregion->length = 2;
+               oobregion->length = USER_DATA_SZ - 2;
 
                return 0;
        }