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 <[email protected]>
Cc: Peter Pan <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
[Miquel: squashed the fix about the chip's size check]
Signed-off-by: Miquel Raynal <[email protected]>