diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-05-27 13:59:22 -0400 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-05-30 10:02:03 -0400 |
commit | 69ae561f4557d31a1dc6d23db5c2735a5568959c (patch) | |
tree | 1fdc265bc17279476045520df5796c952087c069 /drivers | |
parent | 4d5d72b7f1a66e5500691dc5cf1e10effc7f6942 (diff) |
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')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 12 |
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, | |||
14157 | */ | 14157 | */ |
14158 | void intel_plane_destroy(struct drm_plane *plane) | 14158 | void intel_plane_destroy(struct drm_plane *plane) |
14159 | { | 14159 | { |
14160 | struct intel_plane *intel_plane = to_intel_plane(plane); | 14160 | if (!plane) |
14161 | return; | ||
14162 | |||
14161 | drm_plane_cleanup(plane); | 14163 | drm_plane_cleanup(plane); |
14162 | kfree(intel_plane); | 14164 | kfree(to_intel_plane(plane)); |
14163 | } | 14165 | } |
14164 | 14166 | ||
14165 | const struct drm_plane_funcs intel_plane_funcs = { | 14167 | const struct drm_plane_funcs intel_plane_funcs = { |
@@ -14512,10 +14514,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
14512 | return; | 14514 | return; |
14513 | 14515 | ||
14514 | fail: | 14516 | fail: |
14515 | if (primary) | 14517 | intel_plane_destroy(primary); |
14516 | drm_plane_cleanup(primary); | 14518 | intel_plane_destroy(cursor); |
14517 | if (cursor) | ||
14518 | drm_plane_cleanup(cursor); | ||
14519 | kfree(crtc_state); | 14519 | kfree(crtc_state); |
14520 | kfree(intel_crtc); | 14520 | kfree(intel_crtc); |
14521 | } | 14521 | } |