All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: hynix: Use ->exec_op() in hynix_nand_reg_write_op()
Date: Mon, 9 Jul 2018 09:41:52 +0200	[thread overview]
Message-ID: <20180709094152.006ff9ab@xps13> (raw)
In-Reply-To: <20180704140858.28424-1-boris.brezillon@bootlin.com>

Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Wed,  4 Jul 2018
16:08:58 +0200:

> 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>
> ---
>  drivers/mtd/nand/raw/nand_hynix.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> 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);
>  

Applied to nand/next.

Thanks,
Miquèl

      parent reply	other threads:[~2018-07-09  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 14:08 [PATCH] mtd: rawnand: hynix: Use ->exec_op() in hynix_nand_reg_write_op() Boris Brezillon
2018-07-04 14:18 ` Miquel Raynal
2018-07-09  7:41 ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709094152.006ff9ab@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.