Skip to content

Commit

Permalink
drm/i915: Call i915_globals_exit() if pci_register_device() fails
Browse files Browse the repository at this point in the history
[ Upstream commit 1354d83 ]

In the unlikely event that pci_register_device() fails, we were tearing
down our PMU setup but not globals.  This leaves a bunch of memory slabs
lying around.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Fixes: 32eb6bc ("drm/i915: Make request allocation caches global")
[danvet: Fix conflicts against removal of the globals_flush
infrastructure.]
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210721152358.2893314-3-jason@jlekstrand.net
(cherry picked from commit db48488)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[Fixed small conflict while cherry picking]
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
gfxstrand authored and gregkh committed Aug 12, 2021
1 parent d73959c commit 0294ca6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_globals.c
Expand Up @@ -149,7 +149,7 @@ static void __exit __i915_globals_flush(void)
atomic_dec(&active);
}

void __exit i915_globals_exit(void)
void i915_globals_exit(void)
{
GEM_BUG_ON(atomic_read(&active));

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/i915_pci.c
Expand Up @@ -1168,6 +1168,7 @@ static int __init i915_init(void)
err = pci_register_driver(&i915_pci_driver);
if (err) {
i915_pmu_exit();
i915_globals_exit();
return err;
}

Expand Down

0 comments on commit 0294ca6

Please sign in to comment.