Skip to content

Commit

Permalink
gpu/drm: cleanup coding style a bit
Browse files Browse the repository at this point in the history
Remove first assignment to info which is meaningless.
Put the width and higth check first.
This change is to make the code a bit readable.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200907123129.27905-1-bernard@vivo.com
  • Loading branch information
Bernard Zhao authored and Daniel Vetter committed Sep 9, 2020
1 parent deb2464 commit bbd9caa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/gpu/drm/drm_framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ static int framebuffer_check(struct drm_device *dev,
int i;

/* check if the format is supported at all */
info = __drm_format_info(r->pixel_format);
if (!info) {
if (!__drm_format_info(r->pixel_format)) {
struct drm_format_name_buf format_name;

DRM_DEBUG_KMS("bad framebuffer format %s\n",
Expand All @@ -186,9 +185,6 @@ static int framebuffer_check(struct drm_device *dev,
return -EINVAL;
}

/* now let the driver pick its own format info */
info = drm_get_format_info(dev, r);

if (r->width == 0) {
DRM_DEBUG_KMS("bad framebuffer width %u\n", r->width);
return -EINVAL;
Expand All @@ -199,6 +195,9 @@ static int framebuffer_check(struct drm_device *dev,
return -EINVAL;
}

/* now let the driver pick its own format info */
info = drm_get_format_info(dev, r);

for (i = 0; i < info->num_planes; i++) {
unsigned int width = fb_plane_width(r->width, info, i);
unsigned int height = fb_plane_height(r->height, info, i);
Expand Down

0 comments on commit bbd9caa

Please sign in to comment.