Skip to content

Commit

Permalink
drm/i915/selftests: Handle a potential failure of intel_ring_begin
Browse files Browse the repository at this point in the history
Silence smatch over:

drivers/gpu/drm/i915/selftests/intel_workarounds.c:58 read_nonprivs() error: 'cs' dereferencing possible ERR_PTR()

by handling a potential (but unlikely) failure of intel_ring_begin.

Fixes: f4ecfbf ("drm/i915: Check whitelist registers across resets")
Signed-off-by: Oscar Mateo <[email protected]>
Cc: Chris Wilson <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Signed-off-by: Chris Wilson <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
Oscar Mateo authored and ickle committed Apr 17, 2018
1 parent 9f172f6 commit 94f8dfc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/i915/selftests/intel_workarounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ read_nonprivs(struct i915_gem_context *ctx, struct intel_engine_cs *engine)
srm++;

cs = intel_ring_begin(rq, 4 * RING_MAX_NONPRIV_SLOTS);
if (IS_ERR(cs)) {
err = PTR_ERR(cs);
goto err_req;
}

for (i = 0; i < RING_MAX_NONPRIV_SLOTS; i++) {
*cs++ = srm;
*cs++ = i915_mmio_reg_offset(RING_FORCE_TO_NONPRIV(base, i));
Expand All @@ -75,6 +80,8 @@ read_nonprivs(struct i915_gem_context *ctx, struct intel_engine_cs *engine)

return result;

err_req:
i915_request_add(rq);
err_pin:
i915_vma_unpin(vma);
err_obj:
Expand Down

0 comments on commit 94f8dfc

Please sign in to comment.