Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp378379rwl; Thu, 30 Mar 2023 18:00:52 -0700 (PDT) X-Google-Smtp-Source: AK7set+IIqcVx9Wc7juhUcHv3/QdbepGbzHhuLVMR8z4UnycDUZGBtTXeGfm5KXwHhk/S7WwFoyr X-Received: by 2002:a05:6a20:7da6:b0:d9:3de:541e with SMTP id v38-20020a056a207da600b000d903de541emr22294155pzj.6.1680224451659; Thu, 30 Mar 2023 18:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680224451; cv=none; d=google.com; s=arc-20160816; b=TB9+1rHVzw+/oUtDHZ35Vtavv5atPHVS4lrR/TPSIlJdU6YAwxmTek7QE0l1LotJKe K3O2uirkgEgtD/24QDBocNjSYk6pZk0AiL7/BswfQI3i2Z0JwkGNzDiuHmotpknOIylM kS8lN8Ebd7yFwbEG8UnXd4OJuV81X7koLDWG3PFz+YN2TBw5wMF4BVx/FaRlMbPJ2kLY mrLQtqZD6HW0egKd0E/ZuAbcjJzrgG2BcWA86y4jmRjz2v36+5bynHbqxNefbUpZOI3L 47i8zKPN3n7Pp+WLNWT+QoRp70PFdzpP5uAXDfaAaEdh6aDC+ws7fVB9mPB76P4ivJ+3 LecQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q192-20020a632ac9000000b0050bde92f3adsi903703pgq.837.2023.03.30.18.00.39; Thu, 30 Mar 2023 18:00:51 -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 S229921AbjCaA5o (ORCPT + 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 ); 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 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 , Abaci Robot 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: 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 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 Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4667 Signed-off-by: Yang Li --- 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