Received: by 2002:ab3:784e:0:b0:1dc:8548:e819 with SMTP id f14csp135980ltk; Tue, 30 Aug 2022 19:24:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5pKac1VpEBbfhmyqGDfwDvHCqFs0snGp3l1exvstH0VQhOE0xfmtkfUeGPhV5GJ+GeUeAC X-Received: by 2002:aa7:cb06:0:b0:446:7668:2969 with SMTP id s6-20020aa7cb06000000b0044676682969mr22553567edt.206.1661912676410; Tue, 30 Aug 2022 19:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661912676; cv=none; d=google.com; s=arc-20160816; b=s63kCojqtbQTDSYSghWj+mefck4IkzDIay8VAAa2a7RkMSRs4rdnWfWUFvO1dU6l2V DRMIs/53WDPjVY9YvbEgpqXvdp4k7jRRPBIAyxVKMdDmiW/rwg7TgJcu0+VTHgTFUSQw oiTAsBeNI34l0HD64gffAvsblJkvL3G9Pj4b+9PgWrisW14wycuezY5Q+chuOLrQ83jX TNV+YN+3KMUaKC+4DNbDmp0hr6j4KCoG83rPbVqhGyU3ZkFGkwKVly/cQcuIiZk0fBp1 kq/SrrU7g9XCNKtPnaxKgKO9+bOiAaM63KRiyLMwxS2wNmBIuApYJtU50xPKIbOc7wBg BPYg== 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=rajm/EnorvxEMeIhMQwajtUDquuUr65dNofjmlnDPyg=; b=Q3E0Si8LGjo9NQ23qmvPQobA1Q/0D+STpu4fohzQP5bA9FBX5M7iYIOx+DiD/GUsJ5 mcJRvtGZ8jbncrr3dfUc+1NrDBXiIZo2b9RY6NiuuWwOqzEY2mJDeA0DGsvXtekb3xVV iWqrxpNbycsiZtPXfh1wJn+qVylM6mvjSk4Yqg3d1Nl9cJjJ1CUSzJbkiKg3TFRDRNv9 wWcE2ybFZOBZwJfp1StnHPjkwQzG/TixuIvaipXAJ+Qv+oRljH0NfO5MlNjOWD0DYc6V 0GgMzJGfQeghWGgJgutqwsOQSvfFnVh8syfz1Ggw7kbucCgCJeZPwt+4qRHL/O63QfL8 pCzw== 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 qw22-20020a1709066a1600b0073dd78ea4cfsi5854327ejc.413.2022.08.30.19.24.09; Tue, 30 Aug 2022 19:24:36 -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 S231901AbiHaCQm (ORCPT + 99 others); Tue, 30 Aug 2022 22:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiHaCQk (ORCPT ); Tue, 30 Aug 2022 22:16:40 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8CB780F4E; Tue, 30 Aug 2022 19:16:38 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VNolbJn_1661912181; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VNolbJn_1661912181) by smtp.aliyun-inc.com; Wed, 31 Aug 2022 10:16:35 +0800 From: Jiapeng Chong To: yhs@fb.com Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] bpf: Remove useless else if Date: Wed, 31 Aug 2022 10:16:18 +0800 Message-Id: <20220831021618.86770-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 The assignment of the else and else if branches is the same, so the else if here is redundant, so we remove it and add a comment to make the code here readable. ./kernel/bpf/cgroup_iter.c:81:6-8: WARNING: possible condition with no effect (if == else). Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2016 Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- kernel/bpf/cgroup_iter.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c index c69bce2f4403..0d200a993489 100644 --- a/kernel/bpf/cgroup_iter.c +++ b/kernel/bpf/cgroup_iter.c @@ -78,9 +78,7 @@ static void *cgroup_iter_seq_start(struct seq_file *seq, loff_t *pos) return css_next_descendant_pre(NULL, p->start_css); else if (p->order == BPF_CGROUP_ITER_DESCENDANTS_POST) return css_next_descendant_post(NULL, p->start_css); - else if (p->order == BPF_CGROUP_ITER_ANCESTORS_UP) - return p->start_css; - else /* BPF_CGROUP_ITER_SELF_ONLY */ + else /* BPF_CGROUP_ITER_SELF_ONLY and BPF_CGROUP_ITER_ANCESTORS_UP */ return p->start_css; } -- 2.20.1.7.g153144c