The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Bernard Zhao <bernard@vivo.com>
Cc: 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] drm/via: fix assignment in if condition
Date: Wed, 18 Nov 2020 22:28:07 +0100	[thread overview]
Message-ID: <20201118212807.GA401619@phenom.ffwll.local> (raw)
In-Reply-To: <20201118114021.105502-1-bernard@vivo.com>

On Wed, Nov 18, 2020 at 03:40:19AM -0800, Bernard Zhao wrote:
> Fix check_patch.pl warning:
> ERROR: do not use assignment in if condition
> +                       if ((HALCYON_HEADER2 == (cmd = *buf)) &&
> 
> ERROR: do not use assignment in if condition
> +                       if (HALCYON_HEADER2 == (cmd = *buf))
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>

Applied, thanks for your patch.
-Daniel

> ---
>  drivers/gpu/drm/via/via_verifier.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/via/via_verifier.c b/drivers/gpu/drm/via/via_verifier.c
> index 8d8135f424ef..3d6e3a70f318 100644
> --- a/drivers/gpu/drm/via/via_verifier.c
> +++ b/drivers/gpu/drm/via/via_verifier.c
> @@ -1001,8 +1001,8 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size,
>  			state = via_check_vheader6(&buf, buf_end);
>  			break;
>  		case state_command:
> -			if ((HALCYON_HEADER2 == (cmd = *buf)) &&
> -			    supported_3d)
> +			cmd = *buf;
> +			if ((cmd == HALCYON_HEADER2) && supported_3d)
>  				state = state_header2;
>  			else if ((cmd & HALCYON_HEADER1MASK) == HALCYON_HEADER1)
>  				state = state_header1;
> @@ -1064,7 +1064,8 @@ via_parse_command_stream(struct drm_device *dev, const uint32_t *buf,
>  			state = via_parse_vheader6(dev_priv, &buf, buf_end);
>  			break;
>  		case state_command:
> -			if (HALCYON_HEADER2 == (cmd = *buf))
> +			cmd = *buf;
> +			if (cmd == HALCYON_HEADER2)
>  				state = state_header2;
>  			else if ((cmd & HALCYON_HEADER1MASK) == HALCYON_HEADER1)
>  				state = state_header1;
> -- 
> 2.29.0
> 

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

      reply	other threads:[~2020-11-18 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 11:40 [PATCH] drm/via: fix assignment in if condition Bernard Zhao
2020-11-18 21:28 ` 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=20201118212807.GA401619@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=opensource.kernel@vivo.com \
    /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