[PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()

Ursulin, Tvrtko tvrtko.ursulin at intel.com
Tue Jun 1 09:19:35 UTC 2021


[Don't see this on intel-gfx so I have to reply with top post.]

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko

-----Original Message-----
From: Zhihao Cheng <chengzhihao1 at huawei.com> 
Sent: Saturday, May 29, 2021 5:33 AM
To: jani.nikula at linux.intel.com; joonas.lahtinen at linux.intel.com; Vivi, Rodrigo <rodrigo.vivi at intel.com>; airlied at linux.ie; daniel at ffwll.ch; chris at chris-wilson.co.uk; Ursulin, Tvrtko <tvrtko.ursulin at intel.com>
Cc: intel-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org; linux-kernel at vger.kernel.org; chengzhihao1 at huawei.com; yukuai3 at huawei.com
Subject: [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()

In case of error, the function live_context() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes: 52c0fdb25c7c9 ("drm/i915: Replace global breadcrumbs ...")
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1 at huawei.com>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index ee8e753d98ce..eae0abd614cb 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1592,8 +1592,8 @@ static int live_breadcrumbs_smoketest(void *arg)
 
 	for (n = 0; n < smoke[0].ncontexts; n++) {
 		smoke[0].contexts[n] = live_context(i915, file);
-		if (!smoke[0].contexts[n]) {
-			ret = -ENOMEM;
+		if (IS_ERR(smoke[0].contexts[n])) {
+			ret = PTR_ERR(smoke[0].contexts[n]);
 			goto out_contexts;
 		}
 	}
--
2.25.4



More information about the dri-devel mailing list