Commit b2164e48 authored by Chris Wilson's avatar Chris Wilson

drm/i915/execlists: Onion unwind for logical_ring_init() failure

Fix up the error unwind for logical_ring_init() failing by moving the
cleanup into the callers who own the various bits of state during
initialisation, so we don't forget to free the state allocated by the
caller.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180920195948.16448-1-chris@chris-wilson.co.uk
parent 8e1cb32d
...@@ -2396,7 +2396,7 @@ static int logical_ring_init(struct intel_engine_cs *engine) ...@@ -2396,7 +2396,7 @@ static int logical_ring_init(struct intel_engine_cs *engine)
ret = intel_engine_init_common(engine); ret = intel_engine_init_common(engine);
if (ret) if (ret)
goto error; return ret;
if (HAS_LOGICAL_RING_ELSQ(i915)) { if (HAS_LOGICAL_RING_ELSQ(i915)) {
execlists->submit_reg = i915->regs + execlists->submit_reg = i915->regs +
...@@ -2438,10 +2438,6 @@ static int logical_ring_init(struct intel_engine_cs *engine) ...@@ -2438,10 +2438,6 @@ static int logical_ring_init(struct intel_engine_cs *engine)
reset_csb_pointers(execlists); reset_csb_pointers(execlists);
return 0; return 0;
error:
intel_logical_ring_cleanup(engine);
return ret;
} }
int logical_render_ring_init(struct intel_engine_cs *engine) int logical_render_ring_init(struct intel_engine_cs *engine)
...@@ -2464,10 +2460,14 @@ int logical_render_ring_init(struct intel_engine_cs *engine) ...@@ -2464,10 +2460,14 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
engine->emit_breadcrumb = gen8_emit_breadcrumb_rcs; engine->emit_breadcrumb = gen8_emit_breadcrumb_rcs;
engine->emit_breadcrumb_sz = gen8_emit_breadcrumb_rcs_sz; engine->emit_breadcrumb_sz = gen8_emit_breadcrumb_rcs_sz;
ret = intel_engine_create_scratch(engine, PAGE_SIZE); ret = logical_ring_init(engine);
if (ret) if (ret)
return ret; return ret;
ret = intel_engine_create_scratch(engine, PAGE_SIZE);
if (ret)
goto err_cleanup_common;
ret = intel_init_workaround_bb(engine); ret = intel_init_workaround_bb(engine);
if (ret) { if (ret) {
/* /*
...@@ -2479,7 +2479,11 @@ int logical_render_ring_init(struct intel_engine_cs *engine) ...@@ -2479,7 +2479,11 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
ret); ret);
} }
return logical_ring_init(engine); return 0;
err_cleanup_common:
intel_engine_cleanup_common(engine);
return ret;
} }
int logical_xcs_ring_init(struct intel_engine_cs *engine) int logical_xcs_ring_init(struct intel_engine_cs *engine)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment