Input: usbtouchscreen - switch to using kmemdup()
authorJulia Lawall <julia@diku.dk>
Wed, 19 May 2010 17:11:14 +0000 (10:11 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 19 May 2010 17:14:31 +0000 (10:14 -0700)
Use kmemdup when some other buffer is immediately copied into the
allocated region.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/touchscreen/usbtouchscreen.c

index 99330bbdbac761c7f4d940f6b475861eec0bcf91..0b0ae2e17a60c360722e2d21ee9ddda0707f4314 100644 (file)
@@ -811,12 +811,11 @@ static int nexio_init(struct usbtouch_usb *usbtouch)
 
        priv = usbtouch->priv;
 
-       priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL);
+       priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt),
+                               GFP_KERNEL);
        if (!priv->ack_buf)
                goto err_priv;
 
-       memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt));
-
        priv->ack = usb_alloc_urb(0, GFP_KERNEL);
        if (!priv->ack) {
                dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__);