Skip to content

Commit

Permalink
drm/i915: add missing unregister_oom_notifier to the error/unload path
Browse files Browse the repository at this point in the history
I'm trying to reduce the WARNs during driver reload and this was one of
them. Also while at it remove the redundant condition from before
unregister_shrinker().

v2:
- fix the error path too and move the unregister to its logical place
(Chris)
- remove redundant condition from before unregister_shrinker()

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Imre Deak authored and Daniel Vetter committed May 20, 2014
1 parent 646b426 commit 4bdc729
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <acpi/video.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/oom.h>

#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])

Expand Down Expand Up @@ -1741,8 +1742,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
intel_power_domains_remove(dev_priv);
drm_vblank_cleanup(dev);
out_gem_unload:
if (dev_priv->mm.shrinker.scan_objects)
unregister_shrinker(&dev_priv->mm.shrinker);
WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
unregister_shrinker(&dev_priv->mm.shrinker);

if (dev->pdev->msi_enabled)
pci_disable_msi(dev->pdev);
Expand Down Expand Up @@ -1793,8 +1794,8 @@ int i915_driver_unload(struct drm_device *dev)

i915_teardown_sysfs(dev);

if (dev_priv->mm.shrinker.scan_objects)
unregister_shrinker(&dev_priv->mm.shrinker);
WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
unregister_shrinker(&dev_priv->mm.shrinker);

io_mapping_free(dev_priv->gtt.mappable);
arch_phys_wc_del(dev_priv->gtt.mtrr);
Expand Down

0 comments on commit 4bdc729

Please sign in to comment.