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 <mdalam@codeaurora.org>
Change-Id: I35ffd27df9b24ea53aed9e9f0623d8890ba66f06
This commit is contained in:
Md Sadre Alam 2020-06-30 12:37:29 +05:30 committed by Gerrit - the friendly Code Review server
parent 9f5a786d58
commit 3cf90dc5c7

View file

@ -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)) {