[Intel-gfx] [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 27 09:25:03 UTC 2019


Quoting Mika Kuoppala (2019-03-27 09:20:05)
> The live_context() function returns error pointers.  It never returns
> NULL.
> 
> Fixes: 52c0fdb25c7c ("drm/i915: Replace global breadcrumbs with per-context interrupt tracking")
> Signed-off-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/i915_request.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index e6ffe2240126..7c5154dba6d6 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1146,11 +1146,15 @@ static int live_breadcrumbs_smoketest(void *arg)
>  
>         mutex_lock(&i915->drm.struct_mutex);
>         for (n = 0; n < t[0].ncontexts; n++) {
> -               t[0].contexts[n] = live_context(i915, file);
> -               if (!t[0].contexts[n]) {
> +               struct i915_gem_context *ctx;
> +
> +               ctx = live_context(i915, file);
> +               if (IS_ERR(ctx)) {
>                         ret = -ENOMEM;

ret = PTR_ERR(ctx);

Might be interesting if it's not ENOMEM.
-Chris


More information about the Intel-gfx mailing list