dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()
@ 2021-05-29  4:33 Zhihao Cheng
  2021-06-01  9:19 ` Ursulin, Tvrtko
  0 siblings, 1 reply; 3+ messages in thread
From: Zhihao Cheng @ 2021-05-29  4:33 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	chris, tvrtko.ursulin
  Cc: yukuai3, intel-gfx, chengzhihao1, linux-kernel, dri-devel

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@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@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


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

* RE: [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()
  2021-05-29  4:33 [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() Zhihao Cheng
@ 2021-06-01  9:19 ` Ursulin, Tvrtko
  2021-06-02  9:47   ` [Intel-gfx] " Tvrtko Ursulin
  0 siblings, 1 reply; 3+ messages in thread
From: Ursulin, Tvrtko @ 2021-06-01  9:19 UTC (permalink / raw)
  To: Zhihao Cheng, jani.nikula, joonas.lahtinen, Vivi, Rodrigo,
	airlied, daniel, chris
  Cc: yukuai3, intel-gfx, linux-kernel, dri-devel


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

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

Regards,

Tvrtko

-----Original Message-----
From: Zhihao Cheng <chengzhihao1@huawei.com> 
Sent: Saturday, May 29, 2021 5:33 AM
To: jani.nikula@linux.intel.com; joonas.lahtinen@linux.intel.com; Vivi, Rodrigo <rodrigo.vivi@intel.com>; airlied@linux.ie; daniel@ffwll.ch; chris@chris-wilson.co.uk; Ursulin, Tvrtko <tvrtko.ursulin@intel.com>
Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; chengzhihao1@huawei.com; yukuai3@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@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@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


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

* Re: [Intel-gfx] [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()
  2021-06-01  9:19 ` Ursulin, Tvrtko
@ 2021-06-02  9:47   ` Tvrtko Ursulin
  0 siblings, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2021-06-02  9:47 UTC (permalink / raw)
  To: Ursulin, Tvrtko, Zhihao Cheng, jani.nikula, joonas.lahtinen,
	Vivi, Rodrigo, airlied, daniel, chris
  Cc: yukuai3, intel-gfx, linux-kernel, dri-devel


On 01/06/2021 10:19, Ursulin, Tvrtko wrote:
> 
> [Don't see this on intel-gfx so I have to reply with top post.]
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Pushed with commit text wrapped and Fixes: tag fixed, thanks for the patch!

Regards,

Tvrtko

> 
> -----Original Message-----
> From: Zhihao Cheng <chengzhihao1@huawei.com>
> Sent: Saturday, May 29, 2021 5:33 AM
> To: jani.nikula@linux.intel.com; joonas.lahtinen@linux.intel.com; Vivi, Rodrigo <rodrigo.vivi@intel.com>; airlied@linux.ie; daniel@ffwll.ch; chris@chris-wilson.co.uk; Ursulin, Tvrtko <tvrtko.ursulin@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; chengzhihao1@huawei.com; yukuai3@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@huawei.com>
> Signed-off-by: Zhihao Cheng <chengzhihao1@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
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

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

end of thread, other threads:[~2021-06-02  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-29  4:33 [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() Zhihao Cheng
2021-06-01  9:19 ` Ursulin, Tvrtko
2021-06-02  9:47   ` [Intel-gfx] " Tvrtko Ursulin

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