* [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation
[not found] <1438934377-4922-1-git-send-email-a.hajda@samsung.com>
@ 2015-08-07 7:59 ` Andrzej Hajda
2015-09-16 9:52 ` Andrzej Hajda
2015-08-07 7:59 ` [PATCH 16/31] net/cavium/liquidio: " Andrzej Hajda
1 sibling, 1 reply; 5+ messages in thread
From: Andrzej Hajda @ 2015-08-07 7:59 UTC (permalink / raw)
To: linux-arm-kernel
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
arch/arm/mach-lpc32xx/pm.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-lpc32xx/pm.c b/arch/arm/mach-lpc32xx/pm.c
index 207e812..dd3a432 100644
--- a/arch/arm/mach-lpc32xx/pm.c
+++ b/arch/arm/mach-lpc32xx/pm.c
@@ -87,7 +87,8 @@ static int lpc32xx_pm_enter(suspend_state_t state)
void *iram_swap_area;
/* Allocate some space for temporary IRAM storage */
- iram_swap_area = kmalloc(lpc32xx_sys_suspend_sz, GFP_KERNEL);
+ iram_swap_area = kmemdup((void *)TEMP_IRAM_AREA,
+ lpc32xx_sys_suspend_sz, GFP_KERNEL);
if (!iram_swap_area) {
printk(KERN_ERR
"PM Suspend: cannot allocate memory to save portion "
@@ -95,10 +96,6 @@ static int lpc32xx_pm_enter(suspend_state_t state)
return -ENOMEM;
}
- /* Backup a small area of IRAM used for the suspend code */
- memcpy(iram_swap_area, (void *) TEMP_IRAM_AREA,
- lpc32xx_sys_suspend_sz);
-
/*
* Copy code to suspend system into IRAM. The suspend code
* needs to run from IRAM as DRAM may no longer be available
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 16/31] net/cavium/liquidio: use kmemdup rather than duplicating its implementation
[not found] <1438934377-4922-1-git-send-email-a.hajda@samsung.com>
2015-08-07 7:59 ` [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation Andrzej Hajda
@ 2015-08-07 7:59 ` Andrzej Hajda
2015-09-16 10:02 ` Andrzej Hajda
1 sibling, 1 reply; 5+ messages in thread
From: Andrzej Hajda @ 2015-08-07 7:59 UTC (permalink / raw)
To: linux-arm-kernel
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
drivers/net/ethernet/cavium/liquidio/octeon_device.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
index f67641a..8e23e3f 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -602,12 +602,10 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
snprintf(oct->fw_info.liquidio_firmware_version, 32, "LIQUIDIO: %s",
h->version);
- buffer = kmalloc(size, GFP_KERNEL);
+ buffer = kmemdup(data, size, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
- memcpy(buffer, data, size);
-
p = buffer + sizeof(struct octeon_firmware_file_header);
/* load all images */
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation
2015-08-07 7:59 ` [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation Andrzej Hajda
@ 2015-09-16 9:52 ` Andrzej Hajda
2015-09-16 10:06 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Hajda @ 2015-09-16 9:52 UTC (permalink / raw)
To: linux-arm-kernel
Ping.
Regards
Andrzej
On 08/07/2015 09:59 AM, Andrzej Hajda wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> arch/arm/mach-lpc32xx/pm.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-lpc32xx/pm.c b/arch/arm/mach-lpc32xx/pm.c
> index 207e812..dd3a432 100644
> --- a/arch/arm/mach-lpc32xx/pm.c
> +++ b/arch/arm/mach-lpc32xx/pm.c
> @@ -87,7 +87,8 @@ static int lpc32xx_pm_enter(suspend_state_t state)
> void *iram_swap_area;
>
> /* Allocate some space for temporary IRAM storage */
> - iram_swap_area = kmalloc(lpc32xx_sys_suspend_sz, GFP_KERNEL);
> + iram_swap_area = kmemdup((void *)TEMP_IRAM_AREA,
> + lpc32xx_sys_suspend_sz, GFP_KERNEL);
> if (!iram_swap_area) {
> printk(KERN_ERR
> "PM Suspend: cannot allocate memory to save portion "
> @@ -95,10 +96,6 @@ static int lpc32xx_pm_enter(suspend_state_t state)
> return -ENOMEM;
> }
>
> - /* Backup a small area of IRAM used for the suspend code */
> - memcpy(iram_swap_area, (void *) TEMP_IRAM_AREA,
> - lpc32xx_sys_suspend_sz);
> -
> /*
> * Copy code to suspend system into IRAM. The suspend code
> * needs to run from IRAM as DRAM may no longer be available
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 16/31] net/cavium/liquidio: use kmemdup rather than duplicating its implementation
2015-08-07 7:59 ` [PATCH 16/31] net/cavium/liquidio: " Andrzej Hajda
@ 2015-09-16 10:02 ` Andrzej Hajda
0 siblings, 0 replies; 5+ messages in thread
From: Andrzej Hajda @ 2015-09-16 10:02 UTC (permalink / raw)
To: linux-arm-kernel
Ping.
Regards
Andrzej
On 08/07/2015 09:59 AM, Andrzej Hajda wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> drivers/net/ethernet/cavium/liquidio/octeon_device.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> index f67641a..8e23e3f 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> @@ -602,12 +602,10 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
> snprintf(oct->fw_info.liquidio_firmware_version, 32, "LIQUIDIO: %s",
> h->version);
>
> - buffer = kmalloc(size, GFP_KERNEL);
> + buffer = kmemdup(data, size, GFP_KERNEL);
> if (!buffer)
> return -ENOMEM;
>
> - memcpy(buffer, data, size);
> -
> p = buffer + sizeof(struct octeon_firmware_file_header);
>
> /* load all images */
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation
2015-09-16 9:52 ` Andrzej Hajda
@ 2015-09-16 10:06 ` Arnd Bergmann
0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2015-09-16 10:06 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 16 September 2015 11:52:37 Andrzej Hajda wrote:
> > @@ -87,7 +87,8 @@ static int lpc32xx_pm_enter(suspend_state_t state)
> > void *iram_swap_area;
> >
> > /* Allocate some space for temporary IRAM storage */
> > - iram_swap_area = kmalloc(lpc32xx_sys_suspend_sz, GFP_KERNEL);
> > + iram_swap_area = kmemdup((void *)TEMP_IRAM_AREA,
> > + lpc32xx_sys_suspend_sz, GFP_KERNEL);
> > if (!iram_swap_area) {
> > printk(KERN_ERR
> > "PM Suspend: cannot allocate memory to save portion "
> > @@ -95,10 +96,6 @@ static int lpc32xx_pm_enter(suspend_state_t state)
> > return -ENOMEM;
> > }
> >
> > - /* Backup a small area of IRAM used for the suspend code */
> > - memcpy(iram_swap_area, (void *) TEMP_IRAM_AREA,
> > - lpc32xx_sys_suspend_sz);
>
Hmm, the patch looks correct in principle, but I think I'd rather leave the
original version with the comment in place, because the source is not
just random memory but instead some SRAM.
We might want to use memcpy_fromio()/memcpy_toio here and remove the cast for
both copies instead.
Arnd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-16 10:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1438934377-4922-1-git-send-email-a.hajda@samsung.com>
2015-08-07 7:59 ` [PATCH 01/31] arch/arm/mach-lpc32xx: use kmemdup rather than duplicating its implementation Andrzej Hajda
2015-09-16 9:52 ` Andrzej Hajda
2015-09-16 10:06 ` Arnd Bergmann
2015-08-07 7:59 ` [PATCH 16/31] net/cavium/liquidio: " Andrzej Hajda
2015-09-16 10:02 ` Andrzej Hajda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox