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
This commit is contained in:
Коммит
b291a22952
|
@ -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)
|
||||
{
|
||||
int status;
|
||||
bool need_wren = false;
|
||||
|
||||
switch (JEDEC_MFR(jedec_id)) {
|
||||
case CFI_MFR_MACRONIX:
|
||||
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 */:
|
||||
if (need_wren)
|
||||
write_enable(flash);
|
||||
|
||||
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:
|
||||
/* Spansion style */
|
||||
flash->command[0] = OPCODE_BRWR;
|
||||
|
|
|
@ -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;
|
||||
ep = kmalloc(len, GFP_KERNEL);
|
||||
if (!ep) {
|
||||
ret = -ENOMEM;
|
||||
goto ext_out;
|
||||
}
|
||||
if (!ep)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Send our own NAND_CMD_PARAM. */
|
||||
chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
|
||||
|
@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
|
|||
}
|
||||
|
||||
pr_info("ONFI extended param page detected.\n");
|
||||
return 0;
|
||||
ret = 0;
|
||||
|
||||
ext_out:
|
||||
kfree(ep);
|
||||
|
|
Загрузка…
Ссылка в новой задаче