提交 2d2a2b8c 编写于 作者: L Lothar Waßmann 提交者: Boris Brezillon

mtd: nand: complain loudly when chip->bits_per_cell is not correctly initialized

chip->bits_per_cell which is used to determine the NAND cell type
(SLC/MLC) should always have a value != 0.
Complain loudly if the value is 0 in nand_is_slc() to catch use before
correct initialization.
Signed-off-by: NLothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
上级 69fc0129
......@@ -1234,6 +1234,8 @@ int onfi_init_data_interface(struct nand_chip *chip,
*/
static inline bool nand_is_slc(struct nand_chip *chip)
{
WARN(chip->bits_per_cell == 0,
"chip->bits_per_cell is used uninitialized\n");
return chip->bits_per_cell == 1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册