diff options
author | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-07-04 17:08:58 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-07-18 11:10:15 +0300 |
commit | 20366e19e28f9954b25580c020d7a4e0db6055c4 (patch) | |
tree | 7f06333107d8c422f5fb22e525b480bd186fb67a /drivers/mtd/nand/raw/nand_hynix.c | |
parent | f9e64d61042575960ce868fa974d9dbe4937c59a (diff) | |
download | linux-20366e19e28f9954b25580c020d7a4e0db6055c4.tar.xz |
mtd: rawnand: hynix: Use ->exec_op() in hynix_nand_reg_write_op()
Modern NAND controller drivers implement ->exec_op() instead of
->cmdfunc(), make sure we don't end up with a NULL pointer dereference
when hynix_nand_reg_write_op() is called.
Fixes: 8878b126df76 ("mtd: nand: add ->exec_op() implementation")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/nand_hynix.c')
-rw-r--r-- | drivers/mtd/nand/raw/nand_hynix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nand_hynix.c b/drivers/mtd/nand/raw/nand_hynix.c index 8cbe77f447c7..4ffbb26e76d6 100644 --- a/drivers/mtd/nand/raw/nand_hynix.c +++ b/drivers/mtd/nand/raw/nand_hynix.c @@ -100,6 +100,16 @@ static int hynix_nand_reg_write_op(struct nand_chip *chip, u8 addr, u8 val) struct mtd_info *mtd = nand_to_mtd(chip); u16 column = ((u16)addr << 8) | addr; + if (chip->exec_op) { + struct nand_op_instr instrs[] = { + NAND_OP_ADDR(1, &addr, 0), + NAND_OP_8BIT_DATA_OUT(1, &val, 0), + }; + struct nand_operation op = NAND_OPERATION(instrs); + + return nand_exec_op(chip, &op); + } + chip->cmdfunc(mtd, NAND_CMD_NONE, column, -1); chip->write_byte(mtd, val); |