Commit 307b0cf4 authored by Boris Brezillon's avatar Boris Brezillon Committed by Greg Kroah-Hartman
Browse files

mtd: rawnand: hynix: Use ->exec_op() in hynix_nand_reg_write_op()

commit 20366e19 upstream.

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: 8878b126

 ("mtd: nand: add ->exec_op() implementation")
Cc: <>
Signed-off-by: default avatarBoris Brezillon <>
Signed-off-by: default avatarMiquel Raynal <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent d47b35b8
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment