@@ -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;
@@ -113,12 +114,7 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
AFBC_SUPERBLK_ALIGNMENT);
check.min_size[0] = kfb->afbc_size + mode_cmd->offsets[0];
check.use_min_size = true;
-
- ret = drm_gem_fb_size_check_special(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)
@@ -140,10 +136,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_check_special(dev, mode_cmd, &check,
- objs);
}
+ ret = drm_gem_fb_size_check_special(dev, mode_cmd, &check, objs);
if (ret < 0)
goto err_cleanup;
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 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)