From 3cf90dc5c79d36a892098fb4c4edec8a0dd5d07e Mon Sep 17 00:00:00 2001 From: Md Sadre Alam Date: Tue, 30 Jun 2020 12:37:29 +0530 Subject: [PATCH] driver: nand: qpic: Fix memory leak problem in serial training. This change will fix memory leak problem in serial training. For serial tarining we are allocating memory to hold the training pattern buf. For any failure we are freeing the buffer but due to wrong lavel used memory was not getting freed due to this memory leak problem is happening. Signed-off-by: Md Sadre Alam Change-Id: I35ffd27df9b24ea53aed9e9f0623d8890ba66f06 --- drivers/mtd/nand/qpic_nand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/nand/qpic_nand.c b/drivers/mtd/nand/qpic_nand.c index 677a267d82..ba64472806 100644 --- a/drivers/mtd/nand/qpic_nand.c +++ b/drivers/mtd/nand/qpic_nand.c @@ -4219,7 +4219,7 @@ static int qpic_execute_serial_training(struct mtd_info *mtd) ret = qpic_nand_write_page(mtd, pageno, NAND_CFG, &ops); if (ret) { printf("Error in writing training data..\n"); - goto err; + goto free; } /* After write verify the the data with read @ lower frequency * after that only start serial tarining @ higher frequency @@ -4229,14 +4229,14 @@ static int qpic_execute_serial_training(struct mtd_info *mtd) ret = qpic_nand_read_page(mtd, pageno, NAND_CFG, &ops); if (ret) { - printf("%s : Read training data failed.\n",__func__); - goto err; + printf("%s : Read training data failed before training start\n",__func__); + goto free; } /* compare original data and read data */ if (memcmp(data_buff, training_block_128, size)) { printf("Training data read failed @ lower frequency\n"); - goto err; + goto free; } /* disable feed back clock bit to start serial training */ @@ -4264,7 +4264,7 @@ rettry: ret = qpic_nand_read_page(mtd, pageno, NAND_CFG, &ops); if (ret) { printf("%s : Read training data failed.\n",__func__); - goto err; + goto free; } /* compare original data and read data */ if (memcmp(data_buff, training_block_128, size)) {