提交 6d00c9aa 编写于 作者: T Thomas Meyer 提交者: Mauro Carvalho Chehab

[media] pwc: Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.
Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 0ceaec18
...@@ -113,10 +113,9 @@ static int _send_control_msg(struct pwc_device *pdev, ...@@ -113,10 +113,9 @@ static int _send_control_msg(struct pwc_device *pdev,
void *kbuf = NULL; void *kbuf = NULL;
if (buflen) { if (buflen) {
kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ kbuf = kmemdup(buf, buflen, GFP_KERNEL); /* not allowed on stack */
if (kbuf == NULL) if (kbuf == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(kbuf, buf, buflen);
} }
rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册