linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpu: drm: i915: fix error return code of igt_threaded_blt()
@ 2021-03-08  9:07 Jia-Ju Bai
  2021-03-08  9:12 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  9:07 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	chris, matthew.auld
  Cc: intel-gfx, dri-devel, linux-kernel, Jia-Ju Bai

When kcalloc() returns NULL to tsk or thread, no error code of 
igt_threaded_blt() is returned.
To fix this bug, -ENOMEM is returned as error code.

Fixes: 0e99f939f08f ("drm/i915/selftests/blt: add some kthreads into the mix")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
index 23b6e11bbc3e..b54ba8a1fcec 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
@@ -471,11 +471,13 @@ static int igt_threaded_blt(struct intel_engine_cs *engine,
 
 	tsk = kcalloc(n_cpus, sizeof(struct task_struct *), GFP_KERNEL);
 	if (!tsk)
-		return 0;
+		return -ENOMEM;
 
 	thread = kcalloc(n_cpus, sizeof(struct igt_thread_arg), GFP_KERNEL);
-	if (!thread)
+	if (!thread) {
+		err = -ENOMEM;
 		goto out_tsk;
+	}
 
 	thread[0].file = mock_file(engine->i915);
 	if (IS_ERR(thread[0].file)) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpu: drm: i915: fix error return code of igt_threaded_blt()
  2021-03-08  9:07 [PATCH] gpu: drm: i915: fix error return code of igt_threaded_blt() Jia-Ju Bai
@ 2021-03-08  9:12 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2021-03-08  9:12 UTC (permalink / raw)
  To: Jia-Ju Bai, airlied, daniel, jani.nikula, joonas.lahtinen,
	matthew.auld, rodrigo.vivi
  Cc: intel-gfx, dri-devel, linux-kernel, Jia-Ju Bai

Quoting Jia-Ju Bai (2021-03-08 09:07:22)
> When kcalloc() returns NULL to tsk or thread, no error code of 
> igt_threaded_blt() is returned.
> To fix this bug, -ENOMEM is returned as error code.

Because we decided to skip the test if it could not be run due to
insufficient memory, as opposed to an internal allocation failure from
the driver.
-Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-08  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  9:07 [PATCH] gpu: drm: i915: fix error return code of igt_threaded_blt() Jia-Ju Bai
2021-03-08  9:12 ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).