From patchwork Thu Jul 27 00:57:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Li X-Patchwork-Id: 126580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp771079vqo; Wed, 26 Jul 2023 18:19:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlH11VEJcoFcnHtODTFeqop3GeApqnwQevWy3wGr87QaQyfxhqOiJ5Ebd3ipssousmdeESz+ X-Received: by 2002:a05:6808:130b:b0:3a4:3265:e0fe with SMTP id y11-20020a056808130b00b003a43265e0femr1567264oiv.19.1690420772451; Wed, 26 Jul 2023 18:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690420772; cv=none; d=google.com; s=arc-20160816; b=E+BnQa5EJVuoYws2zjEIzGaPQzgoSebE3BUFcMOiiuwJiRpndVSzJMVNFE2UK0LiBY nl6TFmzt73amdz7axO4Pv6T5FmOyuvEyBXJyu5theGTpJ/2CNB2Q4FAmRc5m+yzdAgkw q4MVLoEPP+XD3xM0EK/zNYH5NiSYimWrv7v7jkSkW1wiQhTFk2q7/PV0kwelzbHegSNB ZDuAiCFOnP5AG3bx/h4bkFG0GmcywFzNxqJDUnQzDtgYbDYFB9IRul2K2cH8ox3b2Vyt UuZpq/EVUAuDm5m8Hmqa6xBSaf40pGKHzDegOX/1F20c7DxMkJr/JvCZkI7sw5++kzQf tCIg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a637516000000b00543c8ad57f7si237860pgc.83.2023.07.26.18.19.19; Wed, 26 Jul 2023 18:19:32 -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 S231165AbjG0A5t (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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772534651906735384 X-GMAIL-MSGID: 1772534651906735384 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 Reviewed-by: Simon Horman Acked-by: Hangbin Liu --- 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; }