All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup
@ 2019-07-25  2:09 ` Chuhong Yuan
  0 siblings, 0 replies; 4+ messages in thread
From: Chuhong Yuan @ 2019-07-25  2:09 UTC (permalink / raw)
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, Chuhong Yuan

Instead of using kmalloc + memcpy, use kmemdup
to simplify the code.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 sound/pci/echoaudio/echoaudio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index b612a536a5a1..ca9125726be2 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2189,11 +2189,10 @@ static int snd_echo_resume(struct device *dev)
 	u32 pipe_alloc_mask;
 	int err;
 
-	commpage_bak = kmalloc(sizeof(*commpage), GFP_KERNEL);
+	commpage = chip->comm_page;
+	commpage_bak = kmemdup(commpage, sizeof(*commpage), GFP_KERNEL);
 	if (commpage_bak == NULL)
 		return -ENOMEM;
-	commpage = chip->comm_page;
-	memcpy(commpage_bak, commpage, sizeof(*commpage));
 
 	err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
 	if (err < 0) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup
@ 2019-07-25  2:09 ` Chuhong Yuan
  0 siblings, 0 replies; 4+ messages in thread
From: Chuhong Yuan @ 2019-07-25  2:09 UTC (permalink / raw)
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, Chuhong Yuan

Instead of using kmalloc + memcpy, use kmemdup
to simplify the code.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 sound/pci/echoaudio/echoaudio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index b612a536a5a1..ca9125726be2 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2189,11 +2189,10 @@ static int snd_echo_resume(struct device *dev)
 	u32 pipe_alloc_mask;
 	int err;
 
-	commpage_bak = kmalloc(sizeof(*commpage), GFP_KERNEL);
+	commpage = chip->comm_page;
+	commpage_bak = kmemdup(commpage, sizeof(*commpage), GFP_KERNEL);
 	if (commpage_bak == NULL)
 		return -ENOMEM;
-	commpage = chip->comm_page;
-	memcpy(commpage_bak, commpage, sizeof(*commpage));
 
 	err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
 	if (err < 0) {
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup
  2019-07-25  2:09 ` Chuhong Yuan
@ 2019-07-25 15:50   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-07-25 15:50 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On Thu, 25 Jul 2019 04:09:24 +0200,
Chuhong Yuan wrote:
> 
> Instead of using kmalloc + memcpy, use kmemdup
> to simplify the code.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup
@ 2019-07-25 15:50   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-07-25 15:50 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On Thu, 25 Jul 2019 04:09:24 +0200,
Chuhong Yuan wrote:
> 
> Instead of using kmalloc + memcpy, use kmemdup
> to simplify the code.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-25 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  2:09 [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup Chuhong Yuan
2019-07-25  2:09 ` Chuhong Yuan
2019-07-25 15:50 ` Takashi Iwai
2019-07-25 15:50   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.