Message ID | Y78HoiOWkc3RrEgN@ubun2204.myguest.virtualbox.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3492549wrt; Wed, 11 Jan 2023 11:15:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXttV126H379Iph3F5alqNIjDw0AU56WbTeC3Ma0yMGMcN8dzgV6jYGuY69IGXQBf+X5GN81 X-Received: by 2002:a05:6a20:6d20:b0:ad:dcdf:8c26 with SMTP id fv32-20020a056a206d2000b000addcdf8c26mr80240818pzb.21.1673464511579; Wed, 11 Jan 2023 11:15:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673464511; cv=none; d=google.com; s=arc-20160816; b=I69srRWNkRiujmynzpRG0m7i3N/aI9Q3D7l1pzNGB3SuZMH6wHSetCZVRc/c+Q7uR3 CWEklFFfCR4VrJyRXn37eXIsQ1P3bUMkYzW1UiheaAVqB4FXJ5pUzDdFPH2k9yvIKp+d NGkEyCGdfTU3WS9wAEG5v4Ym1Cx2llBP5KUi2inHWpFTnI/YVmayYzc5b+n01GNX0BH8 O7n7F9EZytPF+hmiLwXy6H6vwZOVRNQSKqO2tAMs8JRt4eUzk1MUIrinLIv92xDG/Vbp Ws/bDxBod4ccVHsmdsamYDkLr2tWMnoO7WK+ic0lkjW7gnl6T7oFRYcuek08g632T7c7 9xBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=SN/THPvTl+wvBxUzavbGm7hIwb8SWcz+CXLJNVXpb4g=; b=E0o31m8RcSbID02Qogwa9qIVAwHkOfCBTCRlD662oqgKxmMGXgbSL7VsfjLC50qEjL R1Y6wZAK3L/NDrQpgreykw/sPE0dAqrjykeiMHeH/lCBsx30ZzyJoxwaTwyDHrjOdNNZ 6iv9XZL254O7SrA8MAGjb85xb4W4dQ1JXgQo3R/Lhp1sHt/apsK8O0Si5HG8/vD1t5Z/ b+XwGJ1ExM4ticfBaRr20oL/5zpV1BTAsGvf3xKCqfUGEx/BZz9FenKAt4XjKB5JUElB b4jxnSrEw5ewY2VaRdcIpXOCHXnvaZh+E6ETZFheIN+ZFeGL2xlmeL15cFDjsSEVMgO8 jIWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="jAwLC/0I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l191-20020a6391c8000000b004b2b138fff9si10310379pge.47.2023.01.11.11.14.58; Wed, 11 Jan 2023 11:15:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="jAwLC/0I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235900AbjAKTCO (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Wed, 11 Jan 2023 14:02:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231527AbjAKTCJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Jan 2023 14:02:09 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FFF3D9F2; Wed, 11 Jan 2023 11:02:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673463717; bh=z4mIkRGmW/UOlyaWLzMaGS4Bp7aO/qtky3A43RvUivg=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=jAwLC/0I1G8qcyvZt4T119gmSNgDdHHM5K0TbaC6QyZjQwnnOMhiBYNzCELTcmkxh RuXzm1imEOwpF5UGiIxwPsKMG7EoTqmfS1RmGh4cVOZV1Lg1KXxrx//nWKXMgSePcr 9iMvzBmIZLVSHRzKfZJiam15LHzsIICgpfZ+CFRk= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 11 Jan 2023 20:01:57 +0100 (CET) X-EA-Auth: CBO1VB7wv7T14fzmCZcRvdILkqKtqF5NZHt40nUuTS+YdQ8EqGZfqd7HPpEaP38NZFt+5jZa6GESvjQnldTM2f+rthHICo9/ Date: Thu, 12 Jan 2023 00:31:54 +0530 From: Deepak R Varma <drv@mailo.com> To: Nilesh Javali <njavali@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar <ssengar@microsoft.com>, Praveen Kumar <kumarpraveen@linux.microsoft.com> Subject: [PATCH] scsi: qla2xxx: Simplify if condition evaluation Message-ID: <Y78HoiOWkc3RrEgN@ubun2204.myguest.virtualbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754754723890652033?= X-GMAIL-MSGID: =?utf-8?q?1754754723890652033?= |
Series |
scsi: qla2xxx: Simplify if condition evaluation
|
|
Commit Message
Deepak R Varma
Jan. 11, 2023, 7:01 p.m. UTC
A logical evaluation of type (!A || A && B) can be simplified as
(!A || B).
Improvement by suggested by excluded_middle.cocci Coccinelel semantic
patch.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Please note: Change is compile tested only.
drivers/scsi/qla2xxx/qla_target.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 1/11/23 11:01, Deepak R Varma wrote: > A logical evaluation of type (!A || A && B) can be simplified as > (!A || B). > Improvement by suggested by excluded_middle.cocci Coccinelel semantic > patch. > > Signed-off-by: Deepak R Varma <drv@mailo.com> > --- > Please note: Change is compile tested only. > > drivers/scsi/qla2xxx/qla_target.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c > index 548f22705ddc..bf6aacf4dbd1 100644 > --- a/drivers/scsi/qla2xxx/qla_target.c > +++ b/drivers/scsi/qla2xxx/qla_target.c > @@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work) > } > > if (ha->flags.edif_enabled && > - (!own || (own && > - own->iocb.u.isp24.status_subcode == ELS_PLOGI))) { > + (own && own->iocb.u.isp24.status_subcode == ELS_PLOGI)) { > sess->edif.authok = 0; > if (!ha->flags.host_shutting_down) { > ql_dbg(ql_dbg_edif, vha, 0x911e, It seems like you missed something in the translation. You left of the "!own" in your replacement. You are translating (!A || A && B) as (A && B). -- Lee Duncan
On Wed, Jan 11, 2023 at 07:26:32PM -0800, Lee Duncan wrote: > On 1/11/23 11:01, Deepak R Varma wrote: > > A logical evaluation of type (!A || A && B) can be simplified as > > (!A || B). > > Improvement by suggested by excluded_middle.cocci Coccinelel semantic > > patch. > > > > Signed-off-by: Deepak R Varma <drv@mailo.com> > > --- > > Please note: Change is compile tested only. > > > > drivers/scsi/qla2xxx/qla_target.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c > > index 548f22705ddc..bf6aacf4dbd1 100644 > > --- a/drivers/scsi/qla2xxx/qla_target.c > > +++ b/drivers/scsi/qla2xxx/qla_target.c > > @@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work) > > } > > if (ha->flags.edif_enabled && > > - (!own || (own && > > - own->iocb.u.isp24.status_subcode == ELS_PLOGI))) { > > + (own && own->iocb.u.isp24.status_subcode == ELS_PLOGI)) { > > sess->edif.authok = 0; > > if (!ha->flags.host_shutting_down) { > > ql_dbg(ql_dbg_edif, vha, 0x911e, > > It seems like you missed something in the translation. You left of the > "!own" in your replacement. You are translating (!A || A && B) as (A && B). Thanks for catching that. My bad. I will correct and send in v2. Regards, ./drv > > -- > Lee Duncan >
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 548f22705ddc..bf6aacf4dbd1 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work) } if (ha->flags.edif_enabled && - (!own || (own && - own->iocb.u.isp24.status_subcode == ELS_PLOGI))) { + (own && own->iocb.u.isp24.status_subcode == ELS_PLOGI)) { sess->edif.authok = 0; if (!ha->flags.host_shutting_down) { ql_dbg(ql_dbg_edif, vha, 0x911e,