Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1243974iol; Fri, 10 Jun 2022 03:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYrAk9gdd2WQ4qzy8Him1IoE53gMqupmk5etN7ZLZLUFFFmixtsqMlOw/aCEtcO+uSO6tB X-Received: by 2002:a63:35ce:0:b0:3fd:fb5a:a1c3 with SMTP id c197-20020a6335ce000000b003fdfb5aa1c3mr17452514pga.85.1654857062336; Fri, 10 Jun 2022 03:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654857062; cv=none; d=google.com; s=arc-20160816; b=F2aHDJ1UPuPUB2VFEWPbF9r9MgJFkumLZr8Ho8ahNWCaxJcaJ0GZmlzhziMt/Duruo enWoNSuqO4u6/hD10m8aGhjJxdwJSpMq3HZc0lBJYozaoy8dU3aL1IQjeMKybK0wbov3 vA8kZN45J+WCedAQcG5oxQ9GHHqLHzdRFRUCE/v0TkbPnz8vFQ0dKhSpH7wa90NOfyiS 0C4rvFVhppuI87BLiCLNXRYxVAMGURPmT51catRfWWtJCLx190uUtv23gu8iZ5kbVtVf LBxXtxMWsZ0NEjNbP+TKTS4CVmDFtbdilzc5ef8JVuNYvf8XKplA/ZEUIIDwwP+co2Dg NEyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=nyxuUva5aLm6uxcb+7iGbcF5RosZggy5+XKisZ3GC3I=; b=p6rIKCOHKx8xEXyg7BP+xAmK45dus5avd5gdFGFlOTs0iYiHkDK9D3jbTCcj7sEDUG BKsLm5g8MoCyPiqT9R0YPa/Fr7yaXYtIXzoZ00TuJydGJww662AxZ2G8XClg8ZpO4TUe EoDY52OI0LFn1u0g5aZTLYbFBU16+mPuiyFfYNTFTimP/svRt5Tg0j4HS2+HCc+Ps8xe WlOi1Pr0w7pxa0DslhobruJSTe4gb3LzFspt3NZhdKFALS3sEkpk+H8frNpydnieFnjf Nsh1bcXdIxZ1Q+y1YRJCiz/nt1ychX+mrVtJfBZibopmQJgsAZx60A4eDIJutu1lCXYr qWsg== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ev5-20020a17090aeac500b001ea4b95ba98si2453405pjb.103.2022.06.10.03.30.48; Fri, 10 Jun 2022 03:31:02 -0700 (PDT) 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; 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346678AbiFJJps (ORCPT + 99 others); Fri, 10 Jun 2022 05:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245750AbiFJJpp (ORCPT ); Fri, 10 Jun 2022 05:45:45 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50883151E7; Fri, 10 Jun 2022 02:45:43 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VFypZVW_1654854332; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VFypZVW_1654854332) by smtp.aliyun-inc.com; Fri, 10 Jun 2022 17:45:41 +0800 From: Jiapeng Chong To: jgg@ziepe.ca Cc: leon@kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] RDMA/cm: fix cond_no_effect.cocci warnings Date: Fri, 10 Jun 2022 17:45:30 +0800 Message-Id: <20220610094530.28950-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 This was found by coccicheck: ./drivers/infiniband/core/cm.c:685:7-9: WARNING: possible condition with no effect (if == else). Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/infiniband/core/cm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 1c107d6d03b9..bb6a2b6b9657 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -676,14 +676,9 @@ static struct cm_id_private *cm_find_listen(struct ib_device *device, refcount_inc(&cm_id_priv->refcount); return cm_id_priv; } - if (device < cm_id_priv->id.device) + if (device < cm_id_priv->id.device || + be64_lt(service_id, cm_id_priv->id.service_id)) node = node->rb_left; - else if (device > cm_id_priv->id.device) - node = node->rb_right; - else if (be64_lt(service_id, cm_id_priv->id.service_id)) - node = node->rb_left; - else if (be64_gt(service_id, cm_id_priv->id.service_id)) - node = node->rb_right; else node = node->rb_right; } -- 2.20.1.7.g153144c