Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <a.hajda@samsung.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
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 <ralf@linux-mips.org>

authored by

Andrzej Hajda and committed by
Ralf Baechle
e5dd8f2c 1d39a5e4

+1 -2
+1 -2
arch/mips/bcm47xx/buttons.c
··· 396 396 { 397 397 size_t size = nbuttons * sizeof(*buttons); 398 398 399 - bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL); 399 + bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL); 400 400 if (!bcm47xx_button_pdata.buttons) 401 401 return -ENOMEM; 402 - memcpy(bcm47xx_button_pdata.buttons, buttons, size); 403 402 bcm47xx_button_pdata.nbuttons = nbuttons; 404 403 405 404 return 0;