mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/tty: Use bitwise instead of arithmetic operator for flags
Date: Fri, 15 Jan 2021 11:09:02 +0100	[thread overview]
Message-ID: <YAFpvgfsR/QSTAg+@kroah.com> (raw)
In-Reply-To: <1610705031-20332-1-git-send-email-abaci-bugfix@linux.alibaba.com>

On Fri, Jan 15, 2021 at 06:03:51PM +0800, Jiapeng Zhong wrote:
> Fix the following coccicheck warning:
> 
> ./drivers/tty/synclink_gt.c:4384:15-16: WARNING: sum of probable
> bitmasks, consider |
> ./drivers/tty/synclink_gt.c:4342:39-40: WARNING: sum of probable
> bitmasks, consider |
> ./drivers/tty/synclink_gt.c:4280:48-49: WARNING: sum of probable
> bitmasks, consider |
> ./drivers/tty/synclink_gt.c:2221:20-21: WARNING: sum of probable
> bitmasks, consider |
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
> ---
>  drivers/tty/synclink_gt.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
> index c0b384e..d302c08 100644
> --- a/drivers/tty/synclink_gt.c
> +++ b/drivers/tty/synclink_gt.c
> @@ -2219,7 +2219,7 @@ static void isr_tdma(struct slgt_info *info)
>  	 */
>  	wr_reg32(info, TDCSR, status);	/* clear pending */
>  
> -	if (status & (BIT5 + BIT4 + BIT3)) {
> +	if (status & (BIT5 | BIT4 | BIT3)) {
>  		// another transmit buffer has completed
>  		// run bottom half to get more send data from user
>  		info->pending_bh |= BH_TRANSMIT;
> @@ -4265,7 +4265,9 @@ static void sync_mode(struct slgt_info *info)
>  	case MGSL_MODE_XSYNC:
>  		val |= BIT15 + BIT13;

Why didn't you also change this line?


>  		break;
> -	case MGSL_MODE_MONOSYNC: val |= BIT14 + BIT13; break;
> +	case MGSL_MODE_MONOSYNC:
> +		val |= BIT14 | BIT13;
> +		break;
>  	case MGSL_MODE_BISYNC:   val |= BIT15; break;
>  	case MGSL_MODE_RAW:      val |= BIT13; break;
>  	}
> @@ -4278,7 +4280,9 @@ static void sync_mode(struct slgt_info *info)
>  	case HDLC_ENCODING_NRZI_MARK:     val |= BIT11; break;
>  	case HDLC_ENCODING_NRZI:          val |= BIT11 + BIT10; break;

Or this line?

Seems like you only changed some of these "warnings", why?

Either fix them all or none :)

thanks,

greg k-h

      reply	other threads:[~2021-01-15 10:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 10:03 Jiapeng Zhong
2021-01-15 10:09 ` Greg KH [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=YAFpvgfsR/QSTAg+@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=abaci-bugfix@linux.alibaba.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®