[PATCHv5 18/34] drm/komeda: Move object assignments to framebuffer to after size checks

Andrzej Pietrasiewicz andrzej.p at collabora.com
Tue Dec 17 14:50:04 UTC 2019


The assignments are the same in both branches of the "if" statement and
nothing depends on them between their original position and the new
position, so this can be safely done.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p at collabora.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index acffceeb26f1..d52278ca27fb 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -166,8 +166,6 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 
 		ret = komeda_fb_afbc_size_check(kfb, info, objs, file,
 						mode_cmd);
-		for (i = 0; i < info->num_planes; ++i)
-			kfb->base.obj[i] = objs[i];
 	} else {
 		ret = komeda_fb_check_src_coords(kfb, 0, 0, kfb->base.width,
 						 kfb->base.height);
@@ -176,8 +174,6 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 
 		ret = komeda_fb_none_afbc_size_check(mdev, info, objs,
 						     file, mode_cmd);
-		for (i = 0; i < info->num_planes; ++i)
-			kfb->base.obj[i] = objs[i];
 	}
 	if (ret < 0)
 		goto err_cleanup;
@@ -189,6 +185,9 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 			goto err_cleanup;
 		}
 
+	for (i = 0; i < info->num_planes; ++i)
+		kfb->base.obj[i] = objs[i];
+
 	ret = drm_framebuffer_init(dev, &kfb->base, &komeda_fb_funcs);
 	if (ret < 0) {
 		DRM_DEBUG_KMS("failed to initialize fb\n");
-- 
2.17.1



More information about the dri-devel mailing list