mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	qat-linux <qat-linux@intel.com>,
	"open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
	<linux-crypto@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"hushiyuan@huawei.com" <hushiyuan@huawei.com>,
	"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: Re: [PATCH] crypto: qat - remove redundant condition accel_dev->is_vf
Date: Fri, 25 Oct 2019 10:50:37 +0100	[thread overview]
Message-ID: <20191025095037.GA19336@sivswdev08.ir.intel.com> (raw)
In-Reply-To: <77832b26242f4987877d6122ba14a0d0@irsmsx101.ger.corp.intel.com>

On Fri, Oct 25, 2019 at 10:45:31AM +0100, Yunfeng Ye wrote:
> On 2019/10/25 17:33, Ard Biesheuvel wrote:
> > On Fri, 25 Oct 2019 at 09:24, Yunfeng Ye <yeyunfeng@huawei.com> wrote:
> >>
> >> Warning is found by the code analysis tool:
> >>   "Redundant condition: accel_dev->is_vf"
> >>
> >> So remove the redundant condition accel_dev->is_vf.
> >>
> >> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> >> ---
> >>  drivers/crypto/qat/qat_common/adf_dev_mgr.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/crypto/qat/qat_common/adf_dev_mgr.c b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> index 2d06409bd3c4..b54b8850fe20 100644
> >> --- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> +++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> @@ -196,7 +196,7 @@ int adf_devmgr_add_dev(struct adf_accel_dev *accel_dev,
> >>         atomic_set(&accel_dev->ref_count, 0);
> >>
> >>         /* PF on host or VF on guest */
> >> -       if (!accel_dev->is_vf || (accel_dev->is_vf && !pf)) {
> >> +       if (!accel_dev->is_vf || !pf) {
> > 
> > I disagree with this change. There is no bug here, and the way the
> > condition is formulated self-documents the code, i.e.,
> > 
> > IF NOT is_vf
> > OR (is_vf BUT NOT pf)
> > 
> > Using an automated tool to reduce every boolean expression to its
> > minimal representation doesn't seem that useful to me, since the
> > compiler is perfectly capable of doing that when generating the object
> > code.
> > 
> ok, thanks, this modify just fix warning, and make code simple.
This change simplifies the code but it makes it less readable.
I'd prefer to leave it as it was.

Regards,

-- 
Giovanni

      parent reply	other threads:[~2019-10-25  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  7:23 Yunfeng Ye
2019-10-25  9:33 ` Ard Biesheuvel
2019-10-25  9:45   ` Yunfeng Ye
     [not found]   ` <77832b26242f4987877d6122ba14a0d0@irsmsx101.ger.corp.intel.com>
2019-10-25  9:50     ` Giovanni Cabiddu [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=20191025095037.GA19336@sivswdev08.ir.intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hushiyuan@huawei.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=yeyunfeng@huawei.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

all inboxes | Powered by JetHome®