diff mbox series

mtd: rawnand: hynix: fixed typo

Message ID 20240313102721.1991299-1-korotkov.maxim.s@gmail.com
State Accepted
Headers show
Series mtd: rawnand: hynix: fixed typo | expand

Commit Message

Maxim Korotkov March 13, 2024, 10:27 a.m. UTC
The function hynix_nand_rr_init() should probably return an error code.
Judging by the usage, it seems that the return code is passed up 
the call stack.
Right now, it always returns 0 and the function hynix_nand_cleanup()
in hynix_nand_init() has never been called.

Found by RASU JSC and Linux Verification Center (linuxtesting.org)

Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")

Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
---
 drivers/mtd/nand/raw/nand_hynix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miquel Raynal March 15, 2024, 11:23 a.m. UTC | #1
Hi Maxim,

korotkov.maxim.s@gmail.com wrote on Wed, 13 Mar 2024 13:27:20 +0300:

> The function hynix_nand_rr_init() should probably return an error code.
> Judging by the usage, it seems that the return code is passed up 
> the call stack.
> Right now, it always returns 0 and the function hynix_nand_cleanup()
> in hynix_nand_init() has never been called.

Isn't it done like that on purpose? Read-retry is not a mandatory
feature.

> Found by RASU JSC and Linux Verification Center (linuxtesting.org)
> 
> Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
> 
> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
> ---

Thanks,
Miquèl
Maxim Korotkov March 15, 2024, 11:45 a.m. UTC | #2
Hi,

On 15.03.2024 14:23, Miquel Raynal wrote:
> Isn't it done like that on purpose? Read-retry is not a mandatory
> feature.

Works it as designed? I'm not sure about it.
I wouldn't rule it out, but it's a little weird that the 
hynix_nand_rr_init() function
is used as if it can return an error but never returns.

Probably  checking  of value returned from hynix_nand_rr_init()
should be removed in hynix_nand_init()

Best regards, Max
Miquel Raynal March 15, 2024, 12:14 p.m. UTC | #3
Hi Maxim,

korotkov.maxim.s@gmail.com wrote on Fri, 15 Mar 2024 14:45:47 +0300:

> Hi,
> 
> On 15.03.2024 14:23, Miquel Raynal wrote:
> > Isn't it done like that on purpose? Read-retry is not a mandatory
> > feature.  
> 
> Works it as designed? I'm not sure about it.
> I wouldn't rule it out, but it's a little weird that the hynix_nand_rr_init() function
> is used as if it can return an error but never returns.
> 
> Probably  checking  of value returned from hynix_nand_rr_init()
> should be removed in hynix_nand_init()

It is indeed confusing. I'll take it.

Thanks,
Miquèl
Miquel Raynal March 25, 2024, 10:18 a.m. UTC | #4
On Wed, 2024-03-13 at 10:27:20 UTC, Maxim Korotkov wrote:
> The function hynix_nand_rr_init() should probably return an error code.
> Judging by the usage, it seems that the return code is passed up 
> the call stack.
> Right now, it always returns 0 and the function hynix_nand_cleanup()
> in hynix_nand_init() has never been called.
> 
> Found by RASU JSC and Linux Verification Center (linuxtesting.org)
> 
> Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
> 
> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel
Miquel Raynal March 25, 2024, 10:20 a.m. UTC | #5
On Wed, 2024-03-13 at 10:27:20 UTC, Maxim Korotkov wrote:
> The function hynix_nand_rr_init() should probably return an error code.
> Judging by the usage, it seems that the return code is passed up 
> the call stack.
> Right now, it always returns 0 and the function hynix_nand_cleanup()
> in hynix_nand_init() has never been called.
> 
> Found by RASU JSC and Linux Verification Center (linuxtesting.org)
> 
> Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
> 
> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel
Andy Shevchenko March 25, 2024, 3:41 p.m. UTC | #6
On Wed, Mar 13, 2024 at 01:27:20PM +0300, Maxim Korotkov wrote:
> The function hynix_nand_rr_init() should probably return an error code.
> Judging by the usage, it seems that the return code is passed up 
> the call stack.
> Right now, it always returns 0 and the function hynix_nand_cleanup()
> in hynix_nand_init() has never been called.
> 
> Found by RASU JSC and Linux Verification Center (linuxtesting.org)

> Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
> 
> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>

FWIW, the tag block shouldn't have blank lines.
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/nand_hynix.c b/drivers/mtd/nand/raw/nand_hynix.c
index 39076735a3fb..9695f07b5eb2 100644
--- a/drivers/mtd/nand/raw/nand_hynix.c
+++ b/drivers/mtd/nand/raw/nand_hynix.c
@@ -402,7 +402,7 @@  static int hynix_nand_rr_init(struct nand_chip *chip)
 	if (ret)
 		pr_warn("failed to initialize read-retry infrastructure");
 
-	return 0;
+	return ret;
 }
 
 static void hynix_nand_extract_oobsize(struct nand_chip *chip,