diff mbox series

drm/lima: fix memdup.cocci warnings

Message ID 20190225183928.GA830@lkp-wsm-ep1 (mailing list archive)
State New, archived
Headers show
Series drm/lima: fix memdup.cocci warnings | expand

Commit Message

kernel test robot Feb. 25, 2019, 6:39 p.m. UTC
From: kbuild test robot <lkp@intel.com>

drivers/gpu/drm/lima/lima_sched.c:115:13-20: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: ef1d65006858 ("drm/lima: driver for ARM Mali4xx GPUs")
CC: Qiang Yu <yuq825@gmail.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Qiang-Yu/drm-export-drm_timeout_abs_to_jiffies/20190226-010350

Please take the patch only if it's a positive warning. Thanks!

 lima_sched.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -112,10 +112,9 @@  int lima_sched_task_init(struct lima_sch
 {
 	int err, i;
 
-	task->bos = kmalloc(sizeof(*bos) * num_bos, GFP_KERNEL);
+	task->bos = kmemdup(bos, sizeof(*bos) * num_bos, GFP_KERNEL);
 	if (!task->bos)
 		return -ENOMEM;
-	memcpy(task->bos, bos, sizeof(*bos) * num_bos);
 
 	for (i = 0; i < num_bos; i++)
 		drm_gem_object_get(&bos[i]->gem);