[PATCHv5 20/34] drm/komeda: Move helper invocation to after size checks

Andrzej Pietrasiewicz
2019-12-17T14:52:53Z

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 --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 42ccd4647919..c2b29d4e6fbb 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -154,7 +154,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]) {
@@ -185,6 +184,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];

@@ -200,7 +201,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);