From 8acc7254577a3007029b4f13c759bf07d6719075 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Tue, 14 Aug 2018 09:41:12 +0200 Subject: [PATCH] drm/scheduler: trivial error handling fix MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Return -ENOMEM when allocating the rq_list fails. Signed-off-by: Christian König Reviewed-by: Huang Rui Reviewed-by: Andrey Grodzovsky Signed-off-by: Alex Deucher --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index f566405f49e3..85c1f95752cc 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -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; -- 2.30.2