aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-11-08 12:10:29 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2010-11-08 16:10:01 -0500
commit56e2ea346ab4c2ea159ecdec85fffc24f50c2903 (patch)
tree7bedc9930635e138fa9a18c50aaf92a45d921639 /drivers/gpu/drm/i915/i915_dma.c
parent374c479bef7ecd2b41d6dd6e24aa21d73b3afae5 (diff)
drm/i915: Fix unload after failed initialisation
If modeset init failed we attempted to unload the module, before we finished setting it up and so triggered various oopses. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index eee88cfcb3aa..307bad0fcef7 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1993,7 +1993,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1993 drm_core_check_feature(dev, DRIVER_MODESET)) { 1993 drm_core_check_feature(dev, DRIVER_MODESET)) {
1994 DRM_ERROR("kernel modesetting requires GEM, disabling driver.\n"); 1994 DRM_ERROR("kernel modesetting requires GEM, disabling driver.\n");
1995 ret = -ENODEV; 1995 ret = -ENODEV;
1996 goto out_iomapfree; 1996 goto out_workqueue_free;
1997 } 1997 }
1998 1998
1999 dev->driver->get_vblank_counter = i915_get_vblank_counter; 1999 dev->driver->get_vblank_counter = i915_get_vblank_counter;
@@ -2016,8 +2016,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2016 /* Init HWS */ 2016 /* Init HWS */
2017 if (!I915_NEED_GFX_HWS(dev)) { 2017 if (!I915_NEED_GFX_HWS(dev)) {
2018 ret = i915_init_phys_hws(dev); 2018 ret = i915_init_phys_hws(dev);
2019 if (ret != 0) 2019 if (ret)
2020 goto out_workqueue_free; 2020 goto out_gem_unload;
2021 } 2021 }
2022 2022
2023 if (IS_PINEVIEW(dev)) 2023 if (IS_PINEVIEW(dev))
@@ -2044,11 +2044,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2044 dev_priv->trace_irq_seqno = 0; 2044 dev_priv->trace_irq_seqno = 0;
2045 2045
2046 ret = drm_vblank_init(dev, I915_NUM_PIPE); 2046 ret = drm_vblank_init(dev, I915_NUM_PIPE);
2047 2047 if (ret)
2048 if (ret) { 2048 goto out_gem_unload;
2049 (void) i915_driver_unload(dev);
2050 return ret;
2051 }
2052 2049
2053 /* Start out suspended */ 2050 /* Start out suspended */
2054 dev_priv->mm.suspended = 1; 2051 dev_priv->mm.suspended = 1;
@@ -2059,7 +2056,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2059 ret = i915_load_modeset_init(dev); 2056 ret = i915_load_modeset_init(dev);
2060 if (ret < 0) { 2057 if (ret < 0) {
2061 DRM_ERROR("failed to init modeset\n"); 2058 DRM_ERROR("failed to init modeset\n");
2062 goto out_workqueue_free; 2059 goto out_gem_unload;
2063 } 2060 }
2064 } 2061 }
2065 2062
@@ -2077,6 +2074,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2077 2074
2078 return 0; 2075 return 0;
2079 2076
2077out_gem_unload:
2078 if (dev->pdev->msi_enabled)
2079 pci_disable_msi(dev->pdev);
2080
2081 intel_teardown_gmbus(dev);
2082 intel_teardown_mchbar(dev);
2080out_workqueue_free: 2083out_workqueue_free:
2081 destroy_workqueue(dev_priv->wq); 2084 destroy_workqueue(dev_priv->wq);
2082out_iomapfree: 2085out_iomapfree: