mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
drivers: rkflash: Fix the error of repeatedly calling memory allocation
Reinit the spiflash in resume ops and result in memory leak. Change-Id: Id0a12f115f267df91e27a9cfc9d01ecce71be256 Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -1058,7 +1058,8 @@ u32 sfc_nand_init(void)
|
||||
return (u32)FTL_UNSUPPORTED_FLASH;
|
||||
}
|
||||
|
||||
gp_page_buf = (u32 *)__get_free_pages(GFP_KERNEL | GFP_DMA32, get_order(SFC_NAND_PAGE_MAX_SIZE));
|
||||
if (!gp_page_buf)
|
||||
gp_page_buf = (u32 *)__get_free_pages(GFP_KERNEL | GFP_DMA32, get_order(SFC_NAND_PAGE_MAX_SIZE));
|
||||
if (!gp_page_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1074,7 +1075,8 @@ u32 sfc_nand_init(void)
|
||||
sfc_nand_dev.prog_lines = DATA_LINES_X1;
|
||||
sfc_nand_dev.page_read_cmd = 0x03;
|
||||
sfc_nand_dev.page_prog_cmd = 0x02;
|
||||
sfc_nand_dev.recheck_buffer = (u8 *)__get_free_pages(GFP_KERNEL | GFP_DMA32, get_order(SFC_NAND_PAGE_MAX_SIZE));
|
||||
if (!sfc_nand_dev.recheck_buffer)
|
||||
sfc_nand_dev.recheck_buffer = (u8 *)__get_free_pages(GFP_KERNEL | GFP_DMA32, get_order(SFC_NAND_PAGE_MAX_SIZE));
|
||||
if (!sfc_nand_dev.recheck_buffer) {
|
||||
pr_err("%s recheck_buffer alloc failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -32,7 +32,8 @@ static int spi_nor_init(void __iomem *reg_addr)
|
||||
struct id_block_tag *idb_tag;
|
||||
struct snor_info_packet *packet;
|
||||
|
||||
sfnor_dev = kzalloc(sizeof(*sfnor_dev), GFP_KERNEL);
|
||||
if (!sfnor_dev)
|
||||
sfnor_dev = kzalloc(sizeof(*sfnor_dev), GFP_KERNEL);
|
||||
|
||||
if (!sfnor_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user