mtd: rawnand: meson: always use OOB bytes during write
authorArseniy Krasnov <avkrasnov@salutedevices.com>
Sun, 22 Dec 2024 21:23:29 +0000 (00:23 +0300)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 16 Mar 2025 13:02:05 +0000 (14:02 +0100)
If 'oob_required' is not set by the caller (for example 'oobbuf' is NULL),
then driver doesn't copy OOB data from 'oob_poi' to special controller
structures, so zeroes will be written as OOB. But, generic raw NAND logic
in 'nand_base.c' already handles case when OOB is not required to write by
filling 'oob_poi' with 0xFF's. So let's remove 'oob_required' check to
always read 'oob_poi' data for OOB.

Kernel driver (drivers/mtd/nand/raw/meson_nand.c) works in the same way,
so need to keep same behaviour here.

Fixes: c2e8c4d09a7a ("mtd: rawnand: Meson NAND controller support")
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/raw/meson_nand.c

index 28c851f..7e683f4 100644 (file)
@@ -618,9 +618,7 @@ static int meson_nfc_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *ch
                memcpy(meson_chip->data_buf, buf, mtd->writesize);
 
        memset(meson_chip->info_buf, 0, chip->ecc.steps * PER_INFO_BYTE);
-
-       if (oob_required)
-               meson_nfc_set_user_byte(chip, chip->oob_poi);
+       meson_nfc_set_user_byte(chip, chip->oob_poi);
 
        return meson_nfc_write_page_sub(chip, page, false);
 }