Skip to contentSkip to conversation

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

PATCH Applied Dan Carpenter 3 participants 3 messages Mar 22, 2017 – Mar 23, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
drivers/mtd/nand/nand_hynix.c +3 -1
index 2a5d0efea498..b12dc7325378 100644
@@ -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++) {
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 22.03.2017 um 10:01 schrieb Dan Carpenter:

Quoted 12 lines

We should be return -ENOMEM instead of success.

Fixes 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs")
drivers/mtd/nand/nand_hynix.c +0 -0
index 2a5d0efea498..b12dc7325378 100644
@@ -270,8 +270,10 @@ static int hynix_mlc_1xnm_rr_init(struct nand_chip *chip,
 		goto out;

drivers/mtd/nand/nand_hynix.c static int hynix_mlc_1xnm_rr_init(struct nand_chip *chip, · line 279

Quoted 10 lines
drivers/mtd/nand/nand_hynix.c +3 -1
 
 	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++) {

Thanks,
//richard

#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · On Wed, 22 Mar 2017 12:01:45 +0300 Dan Carpenter <[email protected]>…

We should be return -ENOMEM instead of success.

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

Applied.

Thanks,

Boris

Quoted 17 lines
drivers/mtd/nand/nand_hynix.c +3 -1
index 2a5d0efea498..b12dc7325378 100644
@@ -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++) {