mtd: nand: hynix: Fix an error code in init
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 22 Mar 2017 09:01:45 +0000 (12:01 +0300)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 23 Mar 2017 09:44:02 +0000 (10:44 +0100)
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@oracle.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/nand_hynix.c

index 2a5d0efea4984c9487c36675a898b696a1cc61b9..b12dc73253783f0737e79da92690c2a092188a9d 100644 (file)
@@ -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++) {