summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorVille Syrjälä2016-05-27 19:59:22 +0200
committerVille Syrjälä2016-05-30 16:02:03 +0200
commit69ae561f4557d31a1dc6d23db5c2735a5568959c (patch)
tree1fdc265bc17279476045520df5796c952087c069 /drivers/gpu/drm/i915/intel_display.c
parentdrm/i915: Set crtc->name to "pipe A", "pipe B", etc. (diff)
downloadkernel-qcow2-linux-69ae561f4557d31a1dc6d23db5c2735a5568959c.tar.gz
kernel-qcow2-linux-69ae561f4557d31a1dc6d23db5c2735a5568959c.tar.xz
kernel-qcow2-linux-69ae561f4557d31a1dc6d23db5c2735a5568959c.zip
drm/i915: Don't leak primary/cursor planes on crtc init failure
Call intel_plane_destroy() instead of drm_plane_cleanup() so that we also free the plane struct itself when bailing out of the crtc init. And make intel_plane_destroy() NULL tolerant to avoid having to check for it in the caller. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1464371966-15190-5-git-send-email-ville.syrjala@linux.intel.com Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 476d76971817..ada0198510d7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14157,9 +14157,11 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,
*/
void intel_plane_destroy(struct drm_plane *plane)
{
- struct intel_plane *intel_plane = to_intel_plane(plane);
+ if (!plane)
+ return;
+
drm_plane_cleanup(plane);
- kfree(intel_plane);
+ kfree(to_intel_plane(plane));
}
const struct drm_plane_funcs intel_plane_funcs = {
@@ -14512,10 +14514,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
return;
fail:
- if (primary)
- drm_plane_cleanup(primary);
- if (cursor)
- drm_plane_cleanup(cursor);
+ intel_plane_destroy(primary);
+ intel_plane_destroy(cursor);
kfree(crtc_state);
kfree(intel_crtc);
}