From 084ffbd7fd147ce6e114d82298c84f143d4fff7f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 17 Jan 2018 23:55:29 +0200 Subject: drm: arm: malidp: Don't destroy planes manually in error handlers The top-level error handler calls drm_mode_config_cleanup() which will destroy all planes. There's no need to destroy them manually in lower error handlers. As plane cleanup is now handled entirely by drm_mode_config_cleanup(), we must ensure that the plane .destroy() handler frees allocated memory for the plane object that was freed by malidp_de_planes_destroy(). Do so by replacing the call to devm_kfree() in the .destroy() handler by kfree(). devm_kfree() is currently a no-op as the plane memory is allocated with kzalloc(), not devm_kzalloc(). Signed-off-by: Laurent Pinchart Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/gpu/drm/arm/malidp_planes.c') diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 1a2992f178e5..648e97693df9 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -64,7 +64,7 @@ static void malidp_de_plane_destroy(struct drm_plane *plane) drm_plane_helper_disable(plane); drm_plane_cleanup(plane); - devm_kfree(plane->dev->dev, mp); + kfree(mp); } /* @@ -449,18 +449,7 @@ int malidp_de_planes_init(struct drm_device *drm) return 0; cleanup: - malidp_de_planes_destroy(drm); kfree(formats); return ret; } - -void malidp_de_planes_destroy(struct drm_device *drm) -{ - struct drm_plane *p, *pt; - - list_for_each_entry_safe(p, pt, &drm->mode_config.plane_list, head) { - drm_plane_cleanup(p); - kfree(p); - } -} -- cgit v1.2.3