[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240514103355.817056-1-s.hauer@pengutronix.de>
Date: Tue, 14 May 2024 12:33:55 +0200
From: Sascha Hauer <s.hauer@...gutronix.de>
To: linux-mtd@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Sascha Hauer <s.hauer@...gutronix.de>
Subject: [PATCH] mtd: rawnand: make rawnand_check_data_only_read_support() work
rawnand_check_data_only_read_support() calls nand_read_data_op() with a
NULL pointer as buffer which will immediately return an error. Allow a
NULL buffer pointer when check_only is requested. This should be safe to
do as nand_read_data_op() has no business in touching the buffer in
check_only mode.
Fixes: 9f820fc0651c ("mtd: rawnand: Check the data only read pattern only once")
Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
---
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 d7dbbd469b892..a5e7d8deafbbe 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -2173,7 +2173,7 @@ EXPORT_SYMBOL_GPL(nand_reset_op);
int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
bool force_8bit, bool check_only)
{
- if (!len || !buf)
+ if (!len || (!buf && !check_only))
return -EINVAL;
if (nand_has_exec_op(chip)) {
--
2.39.2
Powered by blists - more mailing lists