Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1738060rwb; Wed, 26 Jul 2023 18:17:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlEof7DvFhjKvETL47wjE3XN0zFFUTfIYi8YftXt1Di5FF2EfA3Ts7vgB431ZEORDATPGs1l X-Received: by 2002:a17:902:d2cd:b0:1b8:5ab2:49a4 with SMTP id n13-20020a170902d2cd00b001b85ab249a4mr3468292plc.53.1690420668216; Wed, 26 Jul 2023 18:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690420668; cv=none; d=google.com; s=arc-20160816; b=LXLVw6fzTlpm3m/2HkFeDtxb+GtHbkM9H7N64RkTXqHWYxefyYmwh44gmCoch8upSe CDQATcL6JUFMI4KwDMccmXrQjKe4qYRixXJAzY5+ur+h7/Y0xJhkjvbJjwgoUbBFS6+B TEUpfx0hCWCjnsTLNI8VjLte8HlUJM8Idf5Os7HU74MU8pwCGYggd+tCnPmwm42O3aCC lGCaKum9sz7dIqatN+8IMP+lxdnO305UYaBhtwhBmUVHzCv1ledT465Ac0fWDbMHvt41 BnnO14yOxyy48KcefKRPu828TZy88awTy9QSVRpNmuxlOIgA0TLeh4JWlbnmvTtwdZ4q uXhQ== 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=Tjdy8nnG/g55x/EHpnlvTUORwYkbw9b8UpEIs4Qqvfg=; fh=Hl/HepqEB/6d1lqwXuRGxZpzUoickRUE5K2NSgh9X0k=; b=bVzVEmfd9nM/wDEU2Mry0ZrEZqGS3Rjp6hBkIls0eA34e98F1EIHDfQw7qxf4mllSe 6ZcJytsIAkV9y4nAn5paLIxVZ7+VCmVlhifO6wphQXJU49BdlYDW7rwn7UShPf0fl6Te 9Mdp+ZlmwBuhnWQd/oJQRIS2yhYdT+3n2uzRH21RMlxiSqmlfHiGEBie0+B2ps/RB4Yc VZlc6OhMajJ/YxlBdAm6s8wSOTfmtTbusY8y7aQ4H9jSpFrJgq8FcR0FweP3F3Qi1X7O ttis3hYKgxZ8CAuOw6y0s8Ftl4Yio8B/BhujSuimGqN4Sm9YrigXL2KgLR1ncjVNVJf9 TYRQ== 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 l9-20020a170902f68900b001b69de1eae1si264447plg.620.2023.07.26.18.17.35; Wed, 26 Jul 2023 18:17:48 -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 S230497AbjG0A5t (ORCPT + 99 others); Wed, 26 Jul 2023 20:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjG0A5s (ORCPT ); Wed, 26 Jul 2023 20:57:48 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E87A0; Wed, 26 Jul 2023 17:57:46 -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=ay29a033018046060;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0VoIRP9O_1690419462; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0VoIRP9O_1690419462) by smtp.aliyun-inc.com; Thu, 27 Jul 2023 08:57:43 +0800 From: Yang Li To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li , Abaci Robot Subject: [PATCH net-next] team: Remove NULL check before dev_{put, hold} Date: Thu, 27 Jul 2023 08:57:41 +0800 Message-Id: <20230727005741.114069-1-yang.lee@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 call netdev_{put, hold} of dev_{put, hold} will check NULL, so there is no need to check before using dev_{put, hold}, remove it to silence the warning: ./drivers/net/team/team.c:2325:3-10: WARNING: NULL check before dev_{put, hold} functions is not needed. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5991 Signed-off-by: Yang Li --- drivers/net/team/team.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index d3dc22509ea5..bc50fc3f6913 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2321,8 +2321,7 @@ static struct team *team_nl_team_get(struct genl_info *info) ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]); dev = dev_get_by_index(net, ifindex); if (!dev || dev->netdev_ops != &team_netdev_ops) { - if (dev) - dev_put(dev); + dev_put(dev); return NULL; } -- 2.20.1.7.g153144c