gpu/drm: cleanup coding style a bit
Subsystems (2)
PATCH 1/1 gpu/drm: cleanup coding style a bit
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 <[email protected]>
--- drivers/gpu/drm/drm_framebuffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_framebuffer.c +4 -5
@@ -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",
@@ -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 ;
@@ -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);
Signature · 1 line
2.28.0
Quoted 5 lines · Bernard Zhao
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 <[email protected]>
Looks reasonable, thanks for your patch. Applied to drm-misc-next for 5.10.
-Daniel
Quoted 41 lines
--- drivers/gpu/drm/drm_framebuffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_framebuffer.c +4
-5@@ -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",@@ -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 ;@@ -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);Signature · 1 line
2.28.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel