OSDN Git Service

mtd: Add sanity checks in mtd_write/read_oob()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 27 Jun 2017 19:22:21 +0000 (21:22 +0200)
committerRichard Weinberger <richard@nod.at>
Mon, 13 Nov 2017 20:39:19 +0000 (21:39 +0100)
commit5cdd929da53dd7347ec86afd94c3b840909c461e
tree6ea643c6246ad11ac23e921655a47499b4cd6dac
parent9a5941080ef29f1a0347ac2766e4d93312123b21
mtd: Add sanity checks in mtd_write/read_oob()

Unlike what's done in mtd_read/write(), there are no checks to make sure
the parameters passed to mtd_read/write_oob() are consistent, which
forces implementers of ->_read/write_oob() to do it, which in turn leads
to code duplication and possibly errors in the logic.

Do general sanity checks, like ops fields consistency and range checking.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Peter Pan <peterpandong@micron.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/mtdcore.c