diff options
author | Benoit Taine <benoit.taine@lip6.fr> | 2014-05-26 19:21:20 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-30 21:27:09 +0400 |
commit | 58b949e0842a4751eec77edd60bd6178cef5b8de (patch) | |
tree | 009a5f34d67216a11f306e13b6d7ab8abdd3063f /drivers/usb/gadget/lpc32xx_udc.c | |
parent | eac44dc4e769a0f1db244dea13e10923c2877887 (diff) | |
download | linux-58b949e0842a4751eec77edd60bd6178cef5b8de.tar.xz |
usb: gadget: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/lpc32xx_udc.c')
-rw-r--r-- | drivers/usb/gadget/lpc32xx_udc.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c index c77c6872b3ef..a93f64b9e632 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c @@ -3045,11 +3045,10 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev) dma_addr_t dma_handle; struct device_node *isp1301_node; - udc = kzalloc(sizeof(*udc), GFP_KERNEL); + udc = kmemdup(&controller_template, sizeof(*udc), GFP_KERNEL); if (!udc) return -ENOMEM; - memcpy(udc, &controller_template, sizeof(*udc)); for (i = 0; i <= 15; i++) udc->ep[i].udc = udc; udc->gadget.ep0 = &udc->ep[0].ep; |