958738c35ccb8497fb7ad124d40e9756ec126371
[openwrt/openwrt.git] / target / linux / brcm47xx / patches-4.1 / 032-01-MIPS-BCM47xx-Use-kmemdup-rather-than-duplicating-its.patch
1 From e5dd8f2cf65cb228fad881ecd35093d8409d17c6 Mon Sep 17 00:00:00 2001
2 From: Andrzej Hajda <a.hajda@samsung.com>
3 Date: Fri, 7 Aug 2015 09:59:10 +0200
4 Subject: [PATCH] MIPS: BCM47xx: Use kmemdup rather than duplicating its
5 implementation
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 The patch was generated using fixed coccinelle semantic patch
11 scripts/coccinelle/api/memdup.cocci [1].
12
13 [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
14
15 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
16 Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
17 Cc: Hauke Mehrtens <hauke@hauke-m.de>
18 Cc: Rafał Miłecki <zajec5@gmail.com>
19 Cc: Andrzej Hajda <a.hajda@samsung.com>
20 Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
21 Cc: Marek Szyprowski <m.szyprowski@samsung.com>
22 Cc: linux-kernel@vger.kernel.org
23 Cc: linux-mips@linux-mips.org
24 Patchwork: https://patchwork.linux-mips.org/patch/10898/
25 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
26 ---
27 arch/mips/bcm47xx/buttons.c | 3 +--
28 1 file changed, 1 insertion(+), 2 deletions(-)
29
30 diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
31 index 08a4abf..52caa75 100644
32 --- a/arch/mips/bcm47xx/buttons.c
33 +++ b/arch/mips/bcm47xx/buttons.c
34 @@ -396,10 +396,9 @@ static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
35 {
36 size_t size = nbuttons * sizeof(*buttons);
37
38 - bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL);
39 + bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
40 if (!bcm47xx_button_pdata.buttons)
41 return -ENOMEM;
42 - memcpy(bcm47xx_button_pdata.buttons, buttons, size);
43 bcm47xx_button_pdata.nbuttons = nbuttons;
44
45 return 0;
46 --
47 1.8.4.5
48