All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: jing yangyang <cgel.zte@gmail.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	jing yangyang <jing.yangyang@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] s390:fix Coccinelle warnings
Date: Mon, 23 Aug 2021 20:07:57 +0200	[thread overview]
Message-ID: <YSPj/YRDlGqoVu26@osiris> (raw)
In-Reply-To: <20210820025159.11914-1-jing.yangyang@zte.com.cn>

On Thu, Aug 19, 2021 at 07:51:59PM -0700, jing yangyang wrote:
> WARNING !A || A && B is equivalent to !A || B
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
> ---
>  arch/s390/include/asm/scsw.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/include/asm/scsw.h b/arch/s390/include/asm/scsw.h
> index a7c3ccf..754122d 100644
> --- a/arch/s390/include/asm/scsw.h
> +++ b/arch/s390/include/asm/scsw.h
> @@ -691,9 +691,8 @@ static inline int scsw_tm_is_valid_pno(union scsw *scsw)
>  {
>  	return (scsw->tm.fctl != 0) &&
>  	       (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
> -	       (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
> -		 ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
> -		  (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
> +		(!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
> +		(scsw->tm.actl & SCSW_ACTL_SUSPENDED));

This turns something unreadable into something else which is
unreadable. It's up to Vineeth to decide what to do with this.

However I'd prefer if this would be changed into something readable,
maybe as addon patch, like e.g.:

static inline bool scsw_tm_is_valid_pno(union scsw *scsw)
{
	if (scsw->tm.fctl == 0)
		return false;
	if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
		return false;
	if (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS))
		return false;
	if (scsw->tm.actl & SCSW_ACTL_SUSPENDED)
		return false;
	return true;
}

Chances are that the above is wrong... it's just to illustrate ;)

  reply	other threads:[~2021-08-23 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  2:51 [PATCH linux-next] s390:fix Coccinelle warnings jing yangyang
2021-08-23 18:07 ` Heiko Carstens [this message]
2021-08-31  6:15   ` Vineeth Vijayan

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=YSPj/YRDlGqoVu26@osiris \
    --to=hca@linux.ibm.com \
    --cc=abaci-bugfix@linux.alibaba.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cgel.zte@gmail.com \
    --cc=gor@linux.ibm.com \
    --cc=jing.yangyang@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=vneethv@linux.ibm.com \
    --cc=zealci@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.