mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Bernard Zhao <bernard@vivo.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	opensource.kernel@vivo.com
Subject: Re: [PATCH] gpu/drm: cleanup coding style a bit
Date: Mon, 7 Sep 2020 20:17:03 +0200	[thread overview]
Message-ID: <20200907181703.GD2352366@phenom.ffwll.local> (raw)
In-Reply-To: <20200907123129.27905-1-bernard@vivo.com>

On Mon, Sep 07, 2020 at 05:31:29AM -0700, Bernard Zhao wrote:
> 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>

Looks reasonable, thanks for your patch. Applied to drm-misc-next for
5.10.
-Daniel

> ---
>  drivers/gpu/drm/drm_framebuffer.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index df656366a530..2f5b0c2bb0fe 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -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);
> -- 
> 2.28.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2020-09-07 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 12:31 Bernard Zhao
2020-09-07 18:17 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200907181703.GD2352366@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=bernard@vivo.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®