From: kbuild test robot <[email protected]>

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 <[email protected]>
Signed-off-by: kbuild test robot <[email protected]>
---

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(-)

--- 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);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to