Skip to content

Commit 801da46

Browse files
xiongzhongjiangvzapolskiy
authored andcommitted
ARM: lpc32xx: Use kmemdup to replace duplicating its implementation
kmemdup is better than kmalloc() + memcpy(), and we do not like open code. So just use kmemdup instead. Signed-off-by: zhong jiang <zhongjiang@huawei.com> [vzapolskiy: resolved a merge conflict] Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
1 parent ac04fd6 commit 801da46

File tree

1 file changed

+2
-5
lines changed
  • arch/arm/mach-lpc32xx

1 file changed

+2
-5
lines changed

arch/arm/mach-lpc32xx/pm.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,11 @@ static int lpc32xx_pm_enter(suspend_state_t state)
8686
void *iram_swap_area;
8787

8888
/* Allocate some space for temporary IRAM storage */
89-
iram_swap_area = kmalloc(lpc32xx_sys_suspend_sz, GFP_KERNEL);
89+
iram_swap_area = kmemdup((void *)TEMP_IRAM_AREA,
90+
lpc32xx_sys_suspend_sz, GFP_KERNEL);
9091
if (!iram_swap_area)
9192
return -ENOMEM;
9293

93-
/* Backup a small area of IRAM used for the suspend code */
94-
memcpy(iram_swap_area, (void *) TEMP_IRAM_AREA,
95-
lpc32xx_sys_suspend_sz);
96-
9794
/*
9895
* Copy code to suspend system into IRAM. The suspend code
9996
* needs to run from IRAM as DRAM may no longer be available

0 commit comments

Comments
 (0)