diff options
| -rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index e2f58207c779..d1d13d86b7e0 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
| @@ -783,14 +783,23 @@ static int gpmi_alloc_dma_buffer(struct gpmi_nand_data *this) | |||
| 783 | { | 783 | { |
| 784 | struct bch_geometry *geo = &this->bch_geometry; | 784 | struct bch_geometry *geo = &this->bch_geometry; |
| 785 | struct device *dev = this->dev; | 785 | struct device *dev = this->dev; |
| 786 | struct mtd_info *mtd = &this->mtd; | ||
| 786 | 787 | ||
| 787 | /* [1] Allocate a command buffer. PAGE_SIZE is enough. */ | 788 | /* [1] Allocate a command buffer. PAGE_SIZE is enough. */ |
| 788 | this->cmd_buffer = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL); | 789 | this->cmd_buffer = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL); |
| 789 | if (this->cmd_buffer == NULL) | 790 | if (this->cmd_buffer == NULL) |
| 790 | goto error_alloc; | 791 | goto error_alloc; |
| 791 | 792 | ||
| 792 | /* [2] Allocate a read/write data buffer. PAGE_SIZE is enough. */ | 793 | /* |
| 793 | this->data_buffer_dma = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL); | 794 | * [2] Allocate a read/write data buffer. |
| 795 | * The gpmi_alloc_dma_buffer can be called twice. | ||
| 796 | * We allocate a PAGE_SIZE length buffer if gpmi_alloc_dma_buffer | ||
| 797 | * is called before the nand_scan_ident; and we allocate a buffer | ||
| 798 | * of the real NAND page size when the gpmi_alloc_dma_buffer is | ||
| 799 | * called after the nand_scan_ident. | ||
| 800 | */ | ||
| 801 | this->data_buffer_dma = kzalloc(mtd->writesize ?: PAGE_SIZE, | ||
| 802 | GFP_DMA | GFP_KERNEL); | ||
| 794 | if (this->data_buffer_dma == NULL) | 803 | if (this->data_buffer_dma == NULL) |
| 795 | goto error_alloc; | 804 | goto error_alloc; |
| 796 | 805 | ||
