From: Laurent Pinchart Date: Mon, 14 Dec 2015 20:39:29 +0000 (+0200) Subject: drm: omapdrm: Fix plane state free in plane reset handler X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f8ef29ee45664e86805d4359e352a0a9acbd1d13;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm: omapdrm: Fix plane state free in plane reset handler The plane reset handler frees the plane state and allocates a new default state, but when doing so attempt to free the plane state using the base plane state pointer instead of casting it to the driver-specific state object that has been allocated. Fix it by using the omap_plane_atomic_destroy_state() function to destroy the plane state instead of duplicating the code. Signed-off-by: Laurent Pinchart [tomi.valkeinen@ti.com: move of the func into separate patch] Signed-off-by: Tomi Valkeinen --- diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index c3f637491a63..d75b197eff46 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -248,11 +248,10 @@ static void omap_plane_reset(struct drm_plane *plane) struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_plane_state *omap_state; - if (plane->state && plane->state->fb) - drm_framebuffer_unreference(plane->state->fb); - - kfree(plane->state); - plane->state = NULL; + if (plane->state) { + omap_plane_atomic_destroy_state(plane, plane->state); + plane->state = NULL; + } omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL); if (omap_state == NULL)