Skip to content

Commit

Permalink
drm/i915/gt: Cleanup partial engine discovery failures
Browse files Browse the repository at this point in the history
[ Upstream commit 78a0334 ]

If we abort driver initialisation in the middle of gt/engine discovery,
some engines will be fully setup and some not. Those incompletely setup
engines only have 'engine->release == NULL' and so will leak any of the
common objects allocated.

v2:
 - Drop the destroy_pinned_context() helper for now.  It's not really
   worth it with just a single callsite at the moment.  (Janusz)

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220915232654.3283095-2-matthew.d.roper@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ickle-intel authored and gregkh committed Jan 18, 2023
1 parent 5e4194d commit 5c855bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/gpu/drm/i915/gt/intel_engine_cs.c
Expand Up @@ -1343,8 +1343,13 @@ int intel_engines_init(struct intel_gt *gt)
return err;

err = setup(engine);
if (err)
if (err) {
intel_engine_cleanup_common(engine);
return err;
}

/* The backend should now be responsible for cleanup */
GEM_BUG_ON(engine->release == NULL);

err = engine_init_common(engine);
if (err)
Expand Down

0 comments on commit 5c855bc

Please sign in to comment.