mtd: nand: hynix: Fix an error code in init

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed May 10 19:59:06 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=4ca8c1d4979cc60cc129318ce0a89d075c9eb49f
Commit:     4ca8c1d4979cc60cc129318ce0a89d075c9eb49f
Parent:     44dd182861f99f04171256f29b9dc51940757e5d
Author:     Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Wed Mar 22 12:01:45 2017 +0300
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Thu Mar 23 10:44:02 2017 +0100

    mtd: nand: hynix: Fix an error code in init
    
    We should be return -ENOMEM instead of success.
    
    Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
    Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
    Reviewed-by: Richard Weinberger <richard at nod.at>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/nand_hynix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_hynix.c b/drivers/mtd/nand/nand_hynix.c
index 2a5d0ef..b12dc73 100644
--- a/drivers/mtd/nand/nand_hynix.c
+++ b/drivers/mtd/nand/nand_hynix.c
@@ -270,8 +270,10 @@ static int hynix_mlc_1xnm_rr_init(struct nand_chip *chip,
 		goto out;
 
 	rr = kzalloc(sizeof(*rr) + (nregs * nmodes), GFP_KERNEL);
-	if (!rr)
+	if (!rr) {
+		ret = -ENOMEM;
 		goto out;
+	}
 
 	for (i = 0; i < nmodes; i++) {
 		for (j = 0; j < nregs; j++) {



More information about the linux-mtd-cvs mailing list