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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 .../gpu/drm/arm/display/komeda/komeda_framebuffer.c    | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

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;
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux