From patchwork Sat Jan 7 23:27:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 40466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1489585wrt; Sat, 7 Jan 2023 15:36:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGMhHPRHMZMSp2id9v7XoAslmLaaZmSYJbIU5DgxFe6SaEWxG36sFvuz000akoXfFWFjf9 X-Received: by 2002:a05:6a21:99a4:b0:a3:94cd:1435 with SMTP id ve36-20020a056a2199a400b000a394cd1435mr97856852pzb.38.1673134603384; Sat, 07 Jan 2023 15:36:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673134603; cv=none; d=google.com; s=arc-20160816; b=1H7IJbQyL6YWIaKvOdvOZ7AvlfnAUZ4XukFIf6ULI0vcrzgJMdnQGC+UTjvOdFTAwu 2ybXGNOEZAnPY2msVeuitmjiURnJ5dg8auHOvRMXjHqeEDNjMZMU1AJ54UKk21brgkVI ohQstygpWPeev6+iTfrx9NbQe8OUmddBgqCitWSCbLNR+FOb28uY1NpYFgydK/85+FK5 5QnL+m/SSCQ5OYcVM9xi71GOkJuDoCUgRtKvKmAffedeh1B+WJ1Wfl8aAZhuKLOoWXqY g9D5gEm+qEAYuEXYIL9sPDGegxfR9NYwCbkqOWeKC54sNSsrMJvfASGs0u/zA3SnZqNF bcXg== 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=y7AQFGwL1M7uL3ZPX7B/XKLug/Q/FLdaFdVbJv/2+BQ=; b=zGNsv/AKGmYJethPp+cYHRI/+MXmpoGQRsmTJU9jG/dlHsZKFtTOrumVN8/mdwQlkx +9sj2kRfiUlplNoWrAGBVxVXPW7WsAIkDVQormLHLtc6Zd4wPSABdXEI1UWpyj5kYwUp elpPPb4NonCM8kEfHDP0b7iXFP0SaAUoMnhrQsEHoEZX+0WR37YIsOo9B9JR+k1IJmLC 7GEkyJ8hLAsGYGuX2rqFzC22jVCAtFTW3Ayd3WIyS3MRHtGJCHq4M0knMmvNz/84lslk RR7DaJNDCOUeI9oViO+lA3tnxGEwe6O1/eE17EVSobRiF6g7aCuEq94E+W1TYM9K0IsU 2Low== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=MSojlK4Y; 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 g71-20020a636b4a000000b004791c673bdcsi5211034pgc.347.2023.01.07.15.36.29; Sat, 07 Jan 2023 15:36:43 -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=MSojlK4Y; 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 S232748AbjAGX14 (ORCPT + 99 others); Sat, 7 Jan 2023 18:27:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjAGX1z (ORCPT ); Sat, 7 Jan 2023 18:27:55 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1B8B29; Sat, 7 Jan 2023 15:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673134064; bh=243Y0TzJ2D908v665xahpwQFJSh6hNC7mDR/20UOnKs=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=MSojlK4Y3uTQeDIrPA85syXVgUiNaCPqOYoimBfHLPOKfoj1idE3cvx/akKaLLwAh imy9wU64dwn38JGEUCxihO/YJnTfK0nzPurH5ZTpPFqC422fsTQ0xrGCEZgdcsHFBU Sv4ksY5vZpMh2eal51n/YrkzX3pXLj1iK94YPH70= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 8 Jan 2023 00:27:44 +0100 (CET) X-EA-Auth: UMiRvEteWx7loArsC6EMhcnhAXqKgsRmaWo8RYB7LYSw+k2e8VklI5XMtcUsExo8E3EuU7LzyqXlqLeh4MXK9JHdMWo16H6C Date: Sun, 8 Jan 2023 04:57:38 +0530 From: Deepak R Varma To: James Smart , Ram Vegesna , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] scsi: elx: libefc_sli: Optimize the same if/else blocks Message-ID: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754408789842371845?= X-GMAIL-MSGID: =?utf-8?q?1754408789842371845?= The if and else branches have the exact same code, which then always executes independent of the condition evaluation. Simplify the code by removing the redundant branching. Issue identified using the cond_no_effect Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- drivers/scsi/elx/libefc_sli/sli4.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.34.1 diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c index b8c048cdb17f..833fe4bd012e 100644 --- a/drivers/scsi/elx/libefc_sli/sli4.c +++ b/drivers/scsi/elx/libefc_sli/sli4.c @@ -2317,12 +2317,7 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf, SLI4_GENERIC_CONTEXT_VPI << SLI4_BLS_RSP_WQE_CT_SHFT; bls->context_tag = cpu_to_le16(params->vpi); - if (params->s_id != U32_MAX) - bls->local_n_port_id_dword |= - cpu_to_le32(params->s_id & 0x00ffffff); - else - bls->local_n_port_id_dword |= - cpu_to_le32(params->s_id & 0x00ffffff); + bls->local_n_port_id_dword |= cpu_to_le32(params->s_id & 0x00ffffff); dw_ridflags = (dw_ridflags & ~SLI4_BLS_RSP_RID) | (params->d_id & SLI4_BLS_RSP_RID);