[Intel-gfx] [PATCH 5/6] drm/i915: Set crtc->name to "pipe A", "pipe B", etc.

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Thu Nov 12 08:52:25 PST 2015


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b628dab..2b5e81a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10711,6 +10711,7 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
 	struct intel_unpin_work *work;
+	char *name;
 
 	spin_lock_irq(&dev->event_lock);
 	work = intel_crtc->unpin_work;
@@ -10722,8 +10723,13 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
 		kfree(work);
 	}
 
+	/*
+	 * drm_crtc_cleanup() zeroes the structure, so
+	 * need an extra dance to avoid leaking the name.
+	 */
+	name = crtc->name;
 	drm_crtc_cleanup(crtc);
-
+	kfree(name);
 	kfree(intel_crtc);
 }
 
@@ -14036,6 +14042,11 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 	if (intel_crtc == NULL)
 		return;
 
+	intel_crtc->base.name = kasprintf(GFP_KERNEL, "pipe %c",
+					  pipe_name(pipe));
+	if (!intel_crtc->base.name)
+		return;
+
 	crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
 	if (!crtc_state)
 		goto fail;
@@ -14106,6 +14117,7 @@ fail:
 	if (cursor)
 		drm_plane_cleanup(cursor);
 	kfree(crtc_state);
+	kfree(intel_crtc->base.name);
 	kfree(intel_crtc);
 }
 
-- 
2.4.10



More information about the Intel-gfx mailing list