mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 00:08:50 +00:00
media: siano: Use kmemdup instead of duplicating its function
kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. This issue was detected with the help of coccinelle. Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> CC: Tomoki Sekiyama <tomoki.sekiyama@gmail.com> CC: linux-kernel@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
00c30f42c7
commit
0f4bb10857
@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
phdr = kmalloc(size, GFP_KERNEL);
|
||||
phdr = kmemdup(buffer, size, GFP_KERNEL);
|
||||
if (!phdr)
|
||||
return -ENOMEM;
|
||||
memcpy(phdr, buffer, size);
|
||||
|
||||
pr_debug("sending %s(%d) size: %d\n",
|
||||
smscore_translate_msg(phdr->msg_type), phdr->msg_type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user