Message ID | 20230331005718.50060-1-yang.lee@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp239033vqo; Thu, 30 Mar 2023 18:00:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Zn0ZBlZzVmk9Lbg9ub8x6pEHR8BkSEt7pKJbyIK0rdUNIl4VLXet2d15YNx2I40BLV5DNz X-Received: by 2002:a17:90b:4a46:b0:240:b3ae:d881 with SMTP id lb6-20020a17090b4a4600b00240b3aed881mr7666458pjb.5.1680224447662; Thu, 30 Mar 2023 18:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680224447; cv=none; d=google.com; s=arc-20160816; b=0cJYGvI6cpVK1HGcveIikuP4J1i02/xSGgnHMddU6LEfb9mIWz0MiTOXCGdxxQ6iev /pFXZjwpQxT+TbPVjGx26tXWIwFx0XkJQOk3Uoa/oUSD4l0omXAKBe+mbbo31ivHjjPf mBMkbUQHKDrMg+I1m5jepfAMcCzU8MeKQa3/vxSokJ7WPxisMhpgM0e6Vbe87QaNPZhh IUiKrgsA7GTPHPkplPqirUhNSZ1D024EdHjpgpZfCDCEQqBNoSSh1AQCzekDcskadrPa F9uFkEGg1GylqAAw0F6m8tqE2gniE5tq/DHBO6y1F1r/z1Jq7tGDEZ6i0Z+dwqjvBpr5 jkfw== 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=EYlM2USpbV7qfFbl9Mi6rj1j3ahqx6704QlzbdLLkrk=; b=IfTDCmbWRVRbz9oO39WHbUnij2wKuD2+u/tu/uzwk9mgBBnnyrnjYr+MKR1rwbO3C2 gC3Ty7QaZsyVTDgnuKPNNaVa2u+lUZbcooPsgYYTmP3gO0A90ndhbW0eqxLmfRuyIWWi lZeltiFVY92ydvdUm01AS3v1oFjFh3ycZFu6FPdiGJ2JVbthw2JnHkcuz8JmSsT3NfAl sPEV2r/GoxToatyleKw0DK7uDWCUftW9HnqeVrn0e3B43bubSADI9Lz371tB+1tTFYn1 pTmAZ7jw6eklhTXcbkZKUdpgKBWG/K8rI1RS5pw57pEyXKSVjaFvLj6WzEY8v/YdJyAf w0zg== 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 w4-20020a656944000000b00513522ea60asi883828pgq.615.2023.03.30.18.00.32; Thu, 30 Mar 2023 18:00:47 -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 S229820AbjCaA5o (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 20:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbjCaA5k (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 20:57:40 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EE2F12CCD; Thu, 30 Mar 2023 17:57:24 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R921e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0Vf02poT_1680224239; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Vf02poT_1680224239) by smtp.aliyun-inc.com; Fri, 31 Mar 2023 08:57:20 +0800 From: Yang Li <yang.lee@linux.alibaba.com> To: davem@davemloft.net Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, saeedm@nvidia.com, leon@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li <yang.lee@linux.alibaba.com>, Abaci Robot <abaci@linux.alibaba.com> Subject: [PATCH net-next] net/mlx5e: Remove NULL check before dev_{put, hold} Date: Fri, 31 Mar 2023 08:57:18 +0800 Message-Id: <20230331005718.50060-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=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761843030569786025?= X-GMAIL-MSGID: =?utf-8?q?1761843030569786025?= |
Series |
[net-next] net/mlx5e: Remove NULL check before dev_{put, hold}
|
|
Commit Message
Yang Li
March 31, 2023, 12:57 a.m. UTC
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 warnings:
./drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:734:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.
./drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:769:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4667
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
On Fri, Mar 31, 2023 at 08:57:18AM +0800, Yang Li wrote: > 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 warnings: > > ./drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:734:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. > ./drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:769:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. > > Reported-by: Abaci Robot <abaci@linux.alibaba.com> > Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4667 > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Looks good, but I think you missed the one in mlx5e_set_int_port_tunnel(). > --- > drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c > index 20c2d2ecaf93..69ac30a728f4 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c > @@ -730,8 +730,7 @@ static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw, > } > > out: > - if (route_dev) > - dev_put(route_dev); > + dev_put(route_dev); > return err; > } > > @@ -765,8 +764,7 @@ static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw, > mlx5e_tc_match_to_reg_mod_hdr_change(esw->dev, mod_hdr_acts, VPORT_TO_REG, act_id, data); > > out: > - if (route_dev) > - dev_put(route_dev); > + dev_put(route_dev); > return err; > } > > -- > 2.20.1.7.g153144c >
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c index 20c2d2ecaf93..69ac30a728f4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c @@ -730,8 +730,7 @@ static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw, } out: - if (route_dev) - dev_put(route_dev); + dev_put(route_dev); return err; } @@ -765,8 +764,7 @@ static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw, mlx5e_tc_match_to_reg_mod_hdr_change(esw->dev, mod_hdr_acts, VPORT_TO_REG, act_id, data); out: - if (route_dev) - dev_put(route_dev); + dev_put(route_dev); return err; }