diff options
author | Johannes Stezenbach <js@sig21.net> | 2009-10-28 14:21:37 +0100 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2015-05-06 16:15:35 +0100 |
commit | c5951bac9231992fc9adaa11f446c615c8c87a2a (patch) | |
tree | bb63678c6d377e25c0974709726453fdf14efb26 | |
parent | 7a302e460e8bfccbcbfa407f2bfc6855781b58b7 (diff) | |
download | linux-stable-c5951bac9231992fc9adaa11f446c615c8c87a2a.tar.gz |
mtd: m25p80: make command buffer DMA-safe
spi_write() requires the buffer to be DMA-safe, kmalloc()
it seperately to ensure this.
Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
(cherry picked from commit 61c3506c2cabe58bcdfe438d1e57b62994db1616)
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index af7e08a1a24e..355e023d81e2 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -84,7 +84,7 @@ struct m25p { struct mtd_info mtd; unsigned partitioned:1; u8 erase_opcode; - u8 command[CMD_SIZE + FAST_READ_DUMMY_BYTE]; + u8 *command; }; static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd) @@ -767,6 +767,11 @@ static int __devinit m25p_probe(struct spi_device *spi) flash = kzalloc(sizeof *flash, GFP_KERNEL); if (!flash) return -ENOMEM; + flash->command = kmalloc(CMD_SIZE + FAST_READ_DUMMY_BYTE, GFP_KERNEL); + if (!flash->command) { + kfree(flash); + return -ENOMEM; + } flash->spi = spi; mutex_init(&flash->lock); @@ -882,8 +887,10 @@ static int __devexit m25p_remove(struct spi_device *spi) status = del_mtd_partitions(&flash->mtd); else status = del_mtd_device(&flash->mtd); - if (status == 0) + if (status == 0) { + kfree(flash->command); kfree(flash); + } return 0; } |