diff mbox

drm/i915/selftests: Free mock_i915->drm.mode_config

Message ID 20171209210835.32609-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 9, 2017, 9:08 p.m. UTC
Even for the mock i915 device, we need to initialise the
drm.mode_config, as we may ultimately query whether there are any KMS
users deep in the bowels of some paths (e.g. eviction). As we initialise
drm.mode_config we must cleanup after ourselves!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/mock_gem_device.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Matthew Auld Dec. 11, 2017, 11:20 a.m. UTC | #1
On 9 December 2017 at 21:08, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Even for the mock i915 device, we need to initialise the
> drm.mode_config, as we may ultimately query whether there are any KMS
> users deep in the bowels of some paths (e.g. eviction). As we initialise
> drm.mode_config we must cleanup after ourselves!
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Chris Wilson Dec. 11, 2017, 11:25 a.m. UTC | #2
Quoting Matthew Auld (2017-12-11 11:20:24)
> On 9 December 2017 at 21:08, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > Even for the mock i915 device, we need to initialise the
> > drm.mode_config, as we may ultimately query whether there are any KMS
> > users deep in the bowels of some paths (e.g. eviction). As we initialise
> > drm.mode_config we must cleanup after ourselves!
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Thanks and applied,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 80f152aaedf9..1bc61f3f76fc 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -85,6 +85,8 @@  static void mock_device_release(struct drm_device *dev)
 
 	i915_gemfs_fini(i915);
 
+	drm_mode_config_cleanup(&i915->drm);
+
 	drm_dev_fini(&i915->drm);
 	put_device(&i915->drm.pdev->dev);
 }
@@ -187,7 +189,7 @@  struct drm_i915_private *mock_gem_device(void)
 
 	i915->wq = alloc_ordered_workqueue("mock", 0);
 	if (!i915->wq)
-		goto put_device;
+		goto err_drv;
 
 	mock_init_contexts(i915);
 
@@ -266,6 +268,9 @@  struct drm_i915_private *mock_gem_device(void)
 	kmem_cache_destroy(i915->objects);
 err_wq:
 	destroy_workqueue(i915->wq);
+err_drv:
+	drm_mode_config_cleanup(&i915->drm);
+	drm_dev_fini(&i915->drm);
 put_device:
 	put_device(&pdev->dev);
 err: