Reduce dependency of the function on the "info" variable as much as possible. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxxxx> --- .../gpu/drm/arm/display/komeda/komeda_framebuffer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c index 26d1a3cfb587..9139fe5619be 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c @@ -134,7 +134,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) @@ -153,11 +153,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; @@ -177,7 +178,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; @@ -185,7 +186,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; @@ -194,7 +195,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); -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel