From: Andrzej Hajda Date: Fri, 7 Aug 2015 07:59:10 +0000 (+0200) Subject: MIPS: BCM47xx: Use kmemdup rather than duplicating its implementation X-Git-Tag: v4.9.8~3633^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5dd8f2cf65cb228fad881ecd35093d8409d17c6;p=platform%2Fkernel%2Flinux-rpi3.git MIPS: BCM47xx: Use kmemdup rather than duplicating its implementation The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda Acked-by: Hauke Mehrtens Cc: Hauke Mehrtens Cc: Rafał Miłecki Cc: Andrzej Hajda Cc: Bartlomiej Zolnierkiewicz Cc: Marek Szyprowski Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/10898/ Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c index 08a4abf..52caa75 100644 --- a/arch/mips/bcm47xx/buttons.c +++ b/arch/mips/bcm47xx/buttons.c @@ -396,10 +396,9 @@ static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons, { size_t size = nbuttons * sizeof(*buttons); - bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL); + bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL); if (!bcm47xx_button_pdata.buttons) return -ENOMEM; - memcpy(bcm47xx_button_pdata.buttons, buttons, size); bcm47xx_button_pdata.nbuttons = nbuttons; return 0;