drm/i915: Call i915_globals_exit() if pci_register_device() fails

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: 32eb6bcfdd ("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 db484889d1)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[Fixed small conflict while cherry picking]
This commit is contained in:
Jason Ekstrand 2021-07-21 10:23:54 -05:00 committed by Rodrigo Vivi
parent 9c9c6d0ab0
commit 1354d830cb
2 changed files with 2 additions and 1 deletions

View file

@ -148,7 +148,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));

View file

@ -1195,6 +1195,7 @@ static int __init i915_init(void)
err = pci_register_driver(&i915_pci_driver);
if (err) {
i915_pmu_exit();
i915_globals_exit();
return err;
}