mtd: nand: Only allocate ecc->{calc, code}_buf when actually needed
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 5 Dec 2017 11:09:29 +0000 (12:09 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 14 Dec 2017 12:34:23 +0000 (13:34 +0100)
commitaeb93af96d0b0f0916aa0f65fe400a1808ea9cb9
tree070fb22f4a3479b680f2b170b3d2ac49725aa90e
parent8c677541bb24871ce44b5a1e327a3e7f5792eae4
mtd: nand: Only allocate ecc->{calc, code}_buf when actually needed

The only users of the ecc->{calc,code}_buf buffers are NAND controller
drivers implementing ecc->calculate() and/or ecc->correct(). Since the
->oobsize can be non-negligle, especially on modern NAND devices, we'd
better allocate it only when it is actually required.

Make ecc->{calc,code}_buf allocation dependent on the presence of
ecc->calculate() or ecc->correct().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/mtd/nand/nand_base.c