Browse Source

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@oracle.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Dan Carpenter 8 years ago
parent
commit
4ca8c1d497
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/mtd/nand/nand_hynix.c

+ 3 - 1
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++) {