public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390/nmi: Simplify return statement in nmi_registers_valid()
Date: Tue, 9 Sep 2025 08:25:01 +0200	[thread overview]
Message-ID: <20250909062501.8968Abb-hca@linux.ibm.com> (raw)
In-Reply-To: <b1bf1f70-8b4f-4e96-908a-907da1748377-agordeev@linux.ibm.com>

On Mon, Sep 08, 2025 at 06:52:11PM +0200, Alexander Gordeev wrote:
> On Mon, Sep 08, 2025 at 05:32:20PM +0200, Thorsten Blum wrote:
> ...
> > @@ -321,9 +321,7 @@ static bool notrace nmi_registers_valid(union mci mci)
> >  	cr2.reg = get_lowcore()->cregs_save_area[2];
> >  	if (cr2.gse && !mci.gs && !test_cpu_flag(CIF_MCCK_GUEST))
> >  		return false;
> > -	if (!mci.ms || !mci.pm || !mci.ia)
> > -		return false;
> > -	return true;
> > +	return mci.ms && mci.pm && mci.ia;
> >  }
> >  NOKPROBE_SYMBOL(nmi_registers_valid);
> 
> This change does not make the whole function readability better.

It actually would decrease readability since every if-statement tells
you one condition when registers are not valid. Negating the last one
makes this harder to understand.

But in general please do not send patches like this, which do not come
with a significant improvement.

  reply	other threads:[~2025-09-09  6:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 15:32 [PATCH] s390/nmi: Simplify return statement in nmi_registers_valid() Thorsten Blum
2025-09-08 16:52 ` Alexander Gordeev
2025-09-09  6:25   ` Heiko Carstens [this message]
2025-09-09  8:08     ` Thorsten Blum

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=20250909062501.8968Abb-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=thorsten.blum@linux.dev \
    /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