aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index c7a578c954fb..10a6f07eec7f 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -20,6 +20,7 @@
20 */ 20 */
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/slab.h>
23 24
24#include "gpmi-nand.h" 25#include "gpmi-nand.h"
25#include "gpmi-regs.h" 26#include "gpmi-regs.h"
@@ -911,10 +912,14 @@ static int enable_edo_mode(struct gpmi_nand_data *this, int mode)
911 struct resources *r = &this->resources; 912 struct resources *r = &this->resources;
912 struct nand_chip *nand = &this->nand; 913 struct nand_chip *nand = &this->nand;
913 struct mtd_info *mtd = &this->mtd; 914 struct mtd_info *mtd = &this->mtd;
914 uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {}; 915 uint8_t *feature;
915 unsigned long rate; 916 unsigned long rate;
916 int ret; 917 int ret;
917 918
919 feature = kzalloc(ONFI_SUBFEATURE_PARAM_LEN, GFP_KERNEL);
920 if (!feature)
921 return -ENOMEM;
922
918 nand->select_chip(mtd, 0); 923 nand->select_chip(mtd, 0);
919 924
920 /* [1] send SET FEATURE commond to NAND */ 925 /* [1] send SET FEATURE commond to NAND */
@@ -942,11 +947,13 @@ static int enable_edo_mode(struct gpmi_nand_data *this, int mode)
942 947
943 this->flags |= GPMI_ASYNC_EDO_ENABLED; 948 this->flags |= GPMI_ASYNC_EDO_ENABLED;
944 this->timing_mode = mode; 949 this->timing_mode = mode;
950 kfree(feature);
945 dev_info(this->dev, "enable the asynchronous EDO mode %d\n", mode); 951 dev_info(this->dev, "enable the asynchronous EDO mode %d\n", mode);
946 return 0; 952 return 0;
947 953
948err_out: 954err_out:
949 nand->select_chip(mtd, -1); 955 nand->select_chip(mtd, -1);
956 kfree(feature);
950 dev_err(this->dev, "mode:%d ,failed in set feature.\n", mode); 957 dev_err(this->dev, "mode:%d ,failed in set feature.\n", mode);
951 return -EINVAL; 958 return -EINVAL;
952} 959}