On Thu, 2020-09-17 at 07:52:11 UTC, Tudor Ambarus wrote: > In case of valid HW ECC, where the fallback to SW ECC is not needed, > the mentioned commit breaks the "switch (ecc->placement)" statement, > but then wrongly falls through the "case NAND_ECC_SOFT" of the > parent "switch (ecc->mode)". This causes an -EINVAL in > nand_set_ecc_soft_ops(), because for the valid HW ECC cases > ecc->mode is set to NAND_ECC_HW, but the nand_set_ecc_soft_ops() > expects a NAND_ECC_SOFT mode, thus -EINVAL. > > Move the fallback to SW ECC after the setting of the ECC on host ops. > With this, when a valid HW ECC is available, we break the > "switch (ecc->mode)" statement, and when a fallback to SW ECC is > needed, we fallthrough "case NAND_ECC_SOFT". > > Fixes: d3f8ec8e979b ("mtd: rawnand: Separate the ECC engine type and the ECC > byte placement") > Reported-by: Santiago Esteban <santiago.este...@microchip.com> > Signed-off-by: Tudor Ambarus <tudor.amba...@microchip.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel