diff mbox series

[PATCHv4,24/36] drm/komeda: Use return value of drm_gem_fb_lookup

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

Commit Message

Andrzej Pietrasiewicz Dec. 13, 2019, 3:58 p.m. UTC
Reduce dependency of the function on the "info" variable as much as
possible.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 .../gpu/drm/arm/display/komeda/komeda_framebuffer.c   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 74c0caa51bdf..6ac4a599ab5d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -135,7 +135,7 @@  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;
-	int ret = 0, i;
+	int ret = 0, i, num_planes;
 
 	kfb = kzalloc(sizeof(*kfb), GFP_KERNEL);
 	if (!kfb)
@@ -154,11 +154,12 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	ret = drm_gem_fb_lookup(dev, file, mode_cmd, objs);
 	if (ret < 0)
 		goto err_free;
+	num_planes = ret;
 
 	info = drm_get_format_info(dev, mode_cmd);
 
 	if (mode_cmd->modifier[0]) {
-		if (info->num_planes != 1) {
+		if (num_planes != 1) {
 			DRM_DEBUG_KMS("AFBC requires exactly 1 plane.\n");
 			ret = -EINVAL;
 			goto err_cleanup;
@@ -178,7 +179,7 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	if (ret < 0)
 		goto err_cleanup;
 
-	if (info->num_planes == 3)
+	if (num_planes == 3)
 		if (mode_cmd->pitches[1] != mode_cmd->pitches[2]) {
 			DRM_DEBUG_KMS("The pitch[1] and [2] are not same\n");
 			ret = -EINVAL;
@@ -186,7 +187,7 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 		}
 
 	ret = drm_gem_fb_init_with_funcs(&kfb->base, dev, mode_cmd, objs,
-					 info->num_planes, &komeda_fb_funcs);
+					 num_planes, &komeda_fb_funcs);
 	if (ret < 0)
 		goto err_cleanup;
 
@@ -195,7 +196,7 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	return &kfb->base;
 
 err_cleanup:
-	for (i = 0; i < info->num_planes; i++)
+	for (i = 0; i < num_planes; i++)
 		drm_gem_object_put_unlocked(objs[i]);
 err_free:
 	kfree(kfb);