[Intel-gfx] [PATCH v7 04/11] drm/i915: Add teardown path in intel_vgt_ballon()

Zhi Wang zhi.a.wang at intel.com
Tue Jun 7 15:18:40 UTC 2016


This function needs to be changed to have a proper goto teardown path.
Destructors/fini functions are only expected to be called after a
successful initialization, so calling it at random phase in init function
is bad. (Joonas)

Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
---
 drivers/gpu/drm/i915/i915_vgpu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index c9800d4..d41a29e 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -187,7 +187,7 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 
 	unsigned long mappable_base, mappable_size, mappable_end;
 	unsigned long unmappable_base, unmappable_size, unmappable_end;
-	int ret;
+	int ret, i;
 
 	if (!intel_vgpu_active(dev_priv))
 		return 0;
@@ -263,6 +263,9 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 
 err:
 	DRM_ERROR("VGT balloon fail\n");
-	intel_vgt_deballoon(dev_priv);
+	for (i = 0; i < ARRAY_SIZE(bl_info.space); i++) {
+		if (bl_info.space[i].allocated)
+			drm_mm_remove_node(&bl_info.space[i]);
+	}
 	return ret;
 }
-- 
1.9.1



More information about the Intel-gfx mailing list