Commit b291a229 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-20131008' of git://git.infradead.org/linux-mtd

Pull MTD fixes from Brian Norris:
 - fix a small memory leak in some new ONFI code
 - account for additional odd variations of Micron SPI flash

Acked by David Woodhouse.

* tag 'for-linus-20131008' of git://git.infradead.org/linux-mtd:
  mtd: m25p80: Fix 4 byte addressing mode for Micron devices.
  mtd: nand: fix memory leak in ONFI extended parameter page
parents 0e7a3ed0 2b468ef0
...@@ -168,12 +168,25 @@ static inline int write_disable(struct m25p *flash) ...@@ -168,12 +168,25 @@ static inline int write_disable(struct m25p *flash)
*/ */
static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable)
{ {
int status;
bool need_wren = false;
switch (JEDEC_MFR(jedec_id)) { switch (JEDEC_MFR(jedec_id)) {
case CFI_MFR_MACRONIX:
case CFI_MFR_ST: /* Micron, actually */ case CFI_MFR_ST: /* Micron, actually */
/* Some Micron need WREN command; all will accept it */
need_wren = true;
case CFI_MFR_MACRONIX:
case 0xEF /* winbond */: case 0xEF /* winbond */:
if (need_wren)
write_enable(flash);
flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B;
return spi_write(flash->spi, flash->command, 1); status = spi_write(flash->spi, flash->command, 1);
if (need_wren)
write_disable(flash);
return status;
default: default:
/* Spansion style */ /* Spansion style */
flash->command[0] = OPCODE_BRWR; flash->command[0] = OPCODE_BRWR;
......
...@@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, ...@@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
len = le16_to_cpu(p->ext_param_page_length) * 16; len = le16_to_cpu(p->ext_param_page_length) * 16;
ep = kmalloc(len, GFP_KERNEL); ep = kmalloc(len, GFP_KERNEL);
if (!ep) { if (!ep)
ret = -ENOMEM; return -ENOMEM;
goto ext_out;
}
/* Send our own NAND_CMD_PARAM. */ /* Send our own NAND_CMD_PARAM. */
chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
...@@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, ...@@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
} }
pr_info("ONFI extended param page detected.\n"); pr_info("ONFI extended param page detected.\n");
return 0; ret = 0;
ext_out: ext_out:
kfree(ep); kfree(ep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment