aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/m25p80.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 933267a7a2a6..291d5d91892d 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -78,7 +78,7 @@ struct m25p {
78 struct mtd_info mtd; 78 struct mtd_info mtd;
79 unsigned partitioned:1; 79 unsigned partitioned:1;
80 u8 erase_opcode; 80 u8 erase_opcode;
81 u8 command[CMD_SIZE + FAST_READ_DUMMY_BYTE]; 81 u8 *command;
82}; 82};
83 83
84static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd) 84static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
@@ -769,6 +769,11 @@ static int __devinit m25p_probe(struct spi_device *spi)
769 flash = kzalloc(sizeof *flash, GFP_KERNEL); 769 flash = kzalloc(sizeof *flash, GFP_KERNEL);
770 if (!flash) 770 if (!flash)
771 return -ENOMEM; 771 return -ENOMEM;
772 flash->command = kmalloc(CMD_SIZE + FAST_READ_DUMMY_BYTE, GFP_KERNEL);
773 if (!flash->command) {
774 kfree(flash);
775 return -ENOMEM;
776 }
772 777
773 flash->spi = spi; 778 flash->spi = spi;
774 mutex_init(&flash->lock); 779 mutex_init(&flash->lock);
@@ -888,8 +893,10 @@ static int __devexit m25p_remove(struct spi_device *spi)
888 status = del_mtd_partitions(&flash->mtd); 893 status = del_mtd_partitions(&flash->mtd);
889 else 894 else
890 status = del_mtd_device(&flash->mtd); 895 status = del_mtd_device(&flash->mtd);
891 if (status == 0) 896 if (status == 0) {
897 kfree(flash->command);
892 kfree(flash); 898 kfree(flash);
899 }
893 return 0; 900 return 0;
894} 901}
895 902