drm/scheduler: trivial error handling fix
authorChristian König <christian.koenig@amd.com>
Tue, 14 Aug 2018 07:41:12 +0000 (09:41 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:10:42 +0000 (11:10 -0500)
Return -ENOMEM when allocating the rq_list fails.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/scheduler/gpu_scheduler.c

index f566405f49e3c3af9fad4fe3403b44d245a97add..85c1f95752cc47e6d46e3d8deb3c3c256c7f1357 100644 (file)
@@ -191,6 +191,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
        entity->num_rq_list = num_rq_list;
        entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *),
                                GFP_KERNEL);
+       if (!entity->rq_list)
+               return -ENOMEM;
+
        for (i = 0; i < num_rq_list; ++i)
                entity->rq_list[i] = rq_list[i];
        entity->last_scheduled = NULL;