Skip to content

Commit

Permalink
ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup
Browse files Browse the repository at this point in the history
Instead of using kmalloc + memcpy, use kmemdup
to simplify the code.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Chuhong Yuan authored and Takashi Iwai committed Jul 25, 2019
1 parent a30f174 commit 5e291a9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/pci/echoaudio/echoaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5e291a9

Please sign in to comment.