usb:composite: use memcpy to avoid unaligned access
authorPiotr Wilczek <p.wilczek@samsung.com>
Wed, 10 Apr 2013 12:07:51 +0000 (14:07 +0200)
committerMarek Vasut <marex@denx.de>
Sun, 30 Jun 2013 16:41:07 +0000 (18:41 +0200)
This patch memcpy is used instead of an assignment to
avoid unaligned access execption on some ARM platforms.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
drivers/usb/gadget/composite.c

index f30778a163b2950b2681a5ea9b610a7d74d10fb3..f8677931b46cbbda93ff47c516ebae8acbf508cc 100644 (file)
@@ -997,7 +997,8 @@ static int composite_bind(struct usb_gadget *gadget)
        if (status < 0)
                goto fail;
 
-       cdev->desc = *composite->dev;
+       memcpy(&cdev->desc, composite->dev,
+              sizeof(struct usb_device_descriptor));
        cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
 
        debug("%s: ready\n", composite->name);