[igt-dev] [PATCH i-g-t v4 06/14] igt: fb: Refactor dumb buffer allocation path

Maxime Ripard maxime.ripard at bootlin.com
Tue Jan 22 14:28:36 UTC 2019


The else condition is not needed, since all the other conditions return
when they are done.

Move the KMS dumb buffer allocation outside of the outer else condition,
this will also allow to ease later changes.

Reviewed-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
 lib/igt_fb.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a1368ec4703a..0f4021b77e5f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -555,15 +555,14 @@ static int create_bo_for_fb(struct igt_fb *fb)
 			igt_require(driver_has_gem_api);
 			return -EINVAL;
 		}
-	} else {
-		fb->is_dumb = true;
-
-		fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
-						     fb->plane_bpp[0],
-						     &fb->strides[0], &fb->size);
-
-		return fb->gem_handle;
 	}
+
+	fb->is_dumb = true;
+	fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
+					     fb->plane_bpp[0],
+					     &fb->strides[0], &fb->size);
+
+	return fb->gem_handle;
 }
 
 /**
-- 
2.20.1



More information about the igt-dev mailing list