diff mbox series

[PATCHv4,22/36] drm/komeda: Move helper invocation to after size checks

Message ID 20191213155907.16581-23-andrzej.p@collabora.com (mailing list archive)
State New, archived
Headers show
Series AFBC support for Rockchip | expand

Commit Message

Andrzej Pietrasiewicz Dec. 13, 2019, 3:58 p.m. UTC
Between the old and new place nothing depends on data retrieved with the
helper, so it is safe to move its invocation.
The err_cleanup case is changed accordingly.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index ab067f89533c..1a03318ec73a 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -155,7 +155,6 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	if (ret < 0)
 		goto err_free;
 
-	drm_helper_mode_fill_fb_struct(dev, &kfb->base, mode_cmd);
 	info = drm_get_format_info(dev, mode_cmd);
 
 	if (mode_cmd->modifier[0]) {
@@ -186,6 +185,8 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 			goto err_cleanup;
 		}
 
+	drm_helper_mode_fill_fb_struct(dev, &kfb->base, mode_cmd);
+
 	for (i = 0; i < info->num_planes; ++i)
 		kfb->base.obj[i] = objs[i];
 
@@ -201,7 +202,7 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	return &kfb->base;
 
 err_cleanup:
-	for (i = 0; i < kfb->base.format->num_planes; i++)
+	for (i = 0; i < info->num_planes; i++)
 		drm_gem_object_put_unlocked(objs[i]);
 err_free:
 	kfree(kfb);