032-01-MIPS-BCM47xx-Use-kmemdup-rather-than-duplicating-its.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. The patch was generated using fixed coccinelle semantic patch
  10. scripts/coccinelle/api/memdup.cocci [1].
  11. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
  12. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
  13. Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
  14. Cc: Hauke Mehrtens <hauke@hauke-m.de>
  15. Cc: Rafał Miłecki <zajec5@gmail.com>
  16. Cc: Andrzej Hajda <a.hajda@samsung.com>
  17. Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
  18. Cc: Marek Szyprowski <m.szyprowski@samsung.com>
  19. Cc: linux-kernel@vger.kernel.org
  20. Cc: linux-mips@linux-mips.org
  21. Patchwork: https://patchwork.linux-mips.org/patch/10898/
  22. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  23. ---
  24. arch/mips/bcm47xx/buttons.c | 3 +--
  25. 1 file changed, 1 insertion(+), 2 deletions(-)
  26. --- a/arch/mips/bcm47xx/buttons.c
  27. +++ b/arch/mips/bcm47xx/buttons.c
  28. @@ -396,10 +396,9 @@ static int __init bcm47xx_buttons_copy(c
  29. {
  30. size_t size = nbuttons * sizeof(*buttons);
  31. - bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL);
  32. + bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
  33. if (!bcm47xx_button_pdata.buttons)
  34. return -ENOMEM;
  35. - memcpy(bcm47xx_button_pdata.buttons, buttons, size);
  36. bcm47xx_button_pdata.nbuttons = nbuttons;
  37. return 0;