diff mbox series

[PATCHv5,27/34] drm/komeda: Move special helper invocation outside if-else

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

Commit Message

Andrzej Pietrasiewicz Dec. 17, 2019, 2:50 p.m. UTC
The invocation is the same in both cases and is the last thing inside a
block, so move it outside the if-else clause.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 .../gpu/drm/arm/display/komeda/komeda_framebuffer.c    | 10 +++-------
 1 file changed, 3 insertions(+), 7 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 7e02a04cdd11..bf4309b62d37 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -44,6 +44,8 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	struct drm_gem_object *objs[4];
 	struct komeda_fb *kfb;
 	const struct drm_format_info *info;
+	struct drm_size_check check = { 0 };
+
 	int ret = 0, i, num_planes;
 
 	kfb = kzalloc(sizeof(*kfb), GFP_KERNEL);
@@ -68,7 +70,6 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	info = drm_get_format_info(dev, mode_cmd);
 
 	if (mode_cmd->modifier[0]) {
-		struct drm_size_check check = { 0 };
 		u32 alignment_w = 0, alignment_h = 0;
 		u32 alignment_header, n_blocks, bpp;
 
@@ -109,11 +110,7 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 			       + n_blocks * ALIGN(bpp * AFBC_SUPERBLK_PIXELS / 8, AFBC_SUPERBLK_ALIGNMENT);
 		check.min_size[0] = kfb->afbc_size + mode_cmd->offsets[0];
 		check.use_min_size = true;
-
-		ret = drm_gem_fb_size_check2(dev, mode_cmd, &check, objs);
 	} else {
-		struct drm_size_check check = { 0 };
-
 		ret = komeda_fb_check_src_coords(kfb, 0, 0, mode_cmd->width,
 						 mode_cmd->height);
 		if (ret)
@@ -135,9 +132,8 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 		check.pitch_modulo = mdev->chip.bus_width;
 		check.use_pitch_multiplier = true;
 		check.use_min_size = true;
-
-		ret = drm_gem_fb_size_check2(dev, mode_cmd, &check, objs);
 	}
+	ret = drm_gem_fb_size_check2(dev, mode_cmd, &check, objs);
 	if (ret < 0)
 		goto err_cleanup;