]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitd18eae47ccb1da59d11b2834c1b98d41a7441eb3
tree070fb22f4a3479b680f2b170b3d2ac49725aa90e
parentfc3eab8d0e73035fc7a1d757fd2692d1e3c2b3e2
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