diff mbox series

[06/10] mtd: rawnand: Avoid indirect access to ->data_buf()

Message ID 20200424173631.14311-7-miquel.raynal@bootlin.com
State Changes Requested
Delegated to: Miquel Raynal
Headers show
Series Supporting restricted NAND controllers | expand

Commit Message

Miquel Raynal April 24, 2020, 5:36 p.m. UTC
The logic in nand_do_read_ops() is to use a bufpoi variable, either
set to the original buffer, or set to a bounce buffer which in the end
happens to be chip->data_buf depending on the value of the
use_bounce_buf boolean. This is not a reason to call chip->data_buf
directly when we know that we are using the bounce buffer. Let's use
bufpoi instead to be consistent.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Boris Brezillon April 25, 2020, 8:45 a.m. UTC | #1
On Fri, 24 Apr 2020 19:36:27 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> The logic in nand_do_read_ops() is to use a bufpoi variable, either
> set to the original buffer, or set to a bounce buffer which in the end
> happens to be chip->data_buf depending on the value of the
> use_bounce_buf boolean. This is not a reason to call chip->data_buf
> directly when we know that we are using the bounce buffer. Let's use
> bufpoi instead to be consistent.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
>  drivers/mtd/nand/raw/nand_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 0e2dd4c1b44c..15a9189b2307 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -3243,7 +3243,7 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
>  					/* Invalidate page cache */
>  					chip->pagecache.page = -1;
>  				}
> -				memcpy(buf, chip->data_buf + col, bytes);
> +				memcpy(buf, bufpoi + col, bytes);
>  			}
>  
>  			if (unlikely(oob)) {
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 0e2dd4c1b44c..15a9189b2307 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -3243,7 +3243,7 @@  static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
 					/* Invalidate page cache */
 					chip->pagecache.page = -1;
 				}
-				memcpy(buf, chip->data_buf + col, bytes);
+				memcpy(buf, bufpoi + col, bytes);
 			}
 
 			if (unlikely(oob)) {