Matthew Auld <matthew.auld@xxxxxxxxx> writes: > Add some onion to populate_lr_context. > > Fixes: d2b4b97933f5 ("drm/i915: Record the default hw state after reset upon load") > Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/intel_lrc.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c > index 14288743909f..9dd6440eb0e1 100644 > --- a/drivers/gpu/drm/i915/intel_lrc.c > +++ b/drivers/gpu/drm/i915/intel_lrc.c > @@ -2318,8 +2318,10 @@ populate_lr_context(struct i915_gem_context *ctx, > > defaults = i915_gem_object_pin_map(engine->default_state, > I915_MAP_WB); > - if (IS_ERR(defaults)) > - return PTR_ERR(defaults); > + if (IS_ERR(defaults)) { > + ret = PTR_ERR(defaults); > + goto error; I would have used goto unpin_out or error_unpin. This way you can read both parts separately and don't have to go back and forth pairing the parts of onion. Just a stylistic note and as this is the only goto in this func so we can improve if it ever grows. Reviewed-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx> > + } > > memcpy(vaddr + start, defaults + start, engine->context_size); > i915_gem_object_unpin_map(engine->default_state); > @@ -2337,9 +2339,9 @@ populate_lr_context(struct i915_gem_context *ctx, > _MASKED_BIT_ENABLE(CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT | > CTX_CTRL_ENGINE_CTX_SAVE_INHIBIT); > > +error: > i915_gem_object_unpin_map(ctx_obj); > - > - return 0; > + return ret; > } > > static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, > -- > 2.14.3 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx