Skip to content

Commit

Permalink
[media] pwc: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Thomas Meyer authored and Mauro Carvalho Chehab committed Nov 24, 2011
1 parent 0ceaec1 commit 6d00c9a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/video/pwc/pwc-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ static int _send_control_msg(struct pwc_device *pdev,
void *kbuf = NULL;

if (buflen) {
kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */
kbuf = kmemdup(buf, buflen, GFP_KERNEL); /* not allowed on stack */
if (kbuf == NULL)
return -ENOMEM;
memcpy(kbuf, buf, buflen);
}

rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0),
Expand Down

0 comments on commit 6d00c9a

Please sign in to comment.