[PATCH 2/2] mtd: nand: fix error handling in nand_prog_page_op() #2

Miquel Raynal miquel.raynal at bootlin.com
Tue Mar 2 16:32:56 GMT 2021


On Fri, 2021-02-05 at 14:27:25 UTC, Sascha Hauer wrote:
> On success nand_exec_prog_page_op() returns the NAND status byte, but on
> failure it returns a negative error code. nand_prog_page_op() interprets
> the return value as NAND status byte without error checking.  This means
> a failure in nand_exec_prog_page_op() can go through unnoticed.
> 
> The straight forward fix would be to add the missing error checking. To
> clean the code a bit we can move the nand status check to
> nand_prog_page_op().  This way we can get rid of the overloaded return
> value from nand_exec_prog_page_op() and return a plain error code which
> is less error prone.
> 
> nand_exec_prog_page_op() is only called from one other place and in this
> call the 'prog' parameter is false in which case the nand status check
> is skipped, so it's correct to not add the NAND status check there.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel



More information about the linux-mtd mailing list