dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check
@ 2019-03-26  5:08 Dan Carpenter
  2019-03-26  9:30 ` Mika Kuoppala
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2019-03-26  5:08 UTC (permalink / raw)
  To: Jani Nikula, Chris Wilson
  Cc: kernel-janitors, David Airlie, intel-gfx, dri-devel, Thomas Zimmermann

The live_context() function returns error pointers.  It never returns
NULL.

Fixes: 9c1477e83e62 ("drm/i915/selftests: Exercise adding requests to a full GGTT")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
index 9a9451846b33..89766688e420 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
@@ -455,7 +455,7 @@ static int igt_evict_contexts(void *arg)
 			struct i915_gem_context *ctx;
 
 			ctx = live_context(i915, file);
-			if (!ctx)
+			if (IS_ERR(ctx))
 				break;
 
 			/* We will need some GGTT space for the rq's context */
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check
  2019-03-26  5:08 [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check Dan Carpenter
@ 2019-03-26  9:30 ` Mika Kuoppala
  2019-03-26 14:53   ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Mika Kuoppala @ 2019-03-26  9:30 UTC (permalink / raw)
  To: Dan Carpenter, Jani Nikula, Chris Wilson
  Cc: David Airlie, kernel-janitors, intel-gfx, dri-devel, Thomas Zimmermann

Dan Carpenter <dan.carpenter@oracle.com> writes:

> The live_context() function returns error pointers.  It never returns
> NULL.
>
> Fixes: 9c1477e83e62 ("drm/i915/selftests: Exercise adding requests to a full GGTT")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

i915_request.c has another :)

-Mika

> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
> index 9a9451846b33..89766688e420 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
> @@ -455,7 +455,7 @@ static int igt_evict_contexts(void *arg)
>  			struct i915_gem_context *ctx;
>  
>  			ctx = live_context(i915, file);
> -			if (!ctx)
> +			if (IS_ERR(ctx))
>  				break;
>  
>  			/* We will need some GGTT space for the rq's context */
> -- 
> 2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check
  2019-03-26  9:30 ` Mika Kuoppala
@ 2019-03-26 14:53   ` Chris Wilson
  2019-03-26 15:35     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2019-03-26 14:53 UTC (permalink / raw)
  To: Dan Carpenter, Jani Nikula, Mika Kuoppala
  Cc: Tvrtko Ursulin, David Airlie, kernel-janitors, intel-gfx,
	Matthew Auld, dri-devel, Thomas Zimmermann, Rodrigo Vivi

Quoting Mika Kuoppala (2019-03-26 09:30:57)
> Dan Carpenter <dan.carpenter@oracle.com> writes:
> 
> > The live_context() function returns error pointers.  It never returns
> > NULL.
> >
> > Fixes: 9c1477e83e62 ("drm/i915/selftests: Exercise adding requests to a full GGTT")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> 
> i915_request.c has another :)

Having found it, you could have typed up the patch :-p

Thanks for the fix, pushed.
-Chris
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check
  2019-03-26 14:53   ` Chris Wilson
@ 2019-03-26 15:35     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-03-26 15:35 UTC (permalink / raw)
  To: Chris Wilson
  Cc: kernel-janitors, David Airlie, intel-gfx, Thomas Zimmermann, dri-devel

On Tue, Mar 26, 2019 at 02:53:49PM +0000, Chris Wilson wrote:
> Quoting Mika Kuoppala (2019-03-26 09:30:57)
> > Dan Carpenter <dan.carpenter@oracle.com> writes:
> > 
> > > The live_context() function returns error pointers.  It never returns
> > > NULL.
> > >
> > > Fixes: 9c1477e83e62 ("drm/i915/selftests: Exercise adding requests to a full GGTT")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > 
> > i915_request.c has another :)
> 
> Having found it, you could have typed up the patch :-p
> 

Smatch didn't warn about that one because we didn't dereference it right
away...  I should make a check which complains about the condition
instead of the dereference.

regards,
dan carpenter

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2019-03-26 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26  5:08 [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check Dan Carpenter
2019-03-26  9:30 ` Mika Kuoppala
2019-03-26 14:53   ` Chris Wilson
2019-03-26 15:35     ` Dan Carpenter

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