]> 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)
commitc256b4f44e4e837a0396327109bf3d9ce2080a97
tree070fb22f4a3479b680f2b170b3d2ac49725aa90e
parent9aaa82eacda683f6f9d14952db135e4033599d37
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