Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5350152rwl; Mon, 3 Apr 2023 19:12:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YainUyMJnfQqX6RoFrQ/wioXcCYV6tt0aehW0OoqcR4KIPjKXqjVwLA8PhhfTgXKmkVTWw X-Received: by 2002:aa7:9a5c:0:b0:623:cc95:e517 with SMTP id x28-20020aa79a5c000000b00623cc95e517mr684118pfj.17.1680574360092; Mon, 03 Apr 2023 19:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680574360; cv=none; d=google.com; s=arc-20160816; b=UM0psrXN96AtCyqau45y8pogYWFBTzss3QCRWJ2lW9qp0k0uOKajE/m7dH6iYAY6jM M7/R9z4w3vuxRXZ6huNk10GAgAmoUoDP547oGp4w5XrVW+xYPJMLeqfI97BGfvzlavE1 fm2NQP1WjDCrrI1vXWXJs3vL4CgyauJicIjY7k8OaThfl4R99MC4OEBTdrXgKJWvPmBC B6xU5cnXT3FC/C7Atq53ot3p8GtwD5z5Puu5G3gUQnKk+JkC/iPnZEY49RhQy7QhiGMn MVdne+BWU0t6MqH8aNFO6f4gbFw6934RNWgZFrHw4NKusxkiT7o7084eJqHH/y+Iitf3 wA1g== 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=ApmNMdM3nfuAFm+ivbGBP4GKrHZCMgaulWFo3P8qEGo=; b=Du+9k2GSCvDKZ0RAEnhpPewtx1P9ZrrMHAWHU0kX4saYQlBlMqkIK6cY1ZrTQZtRvR JPIIQPZSpdKgSmB4xDZCBSG27yRCL2qVQQyBDKAtA+O/xjaJWpYPovyt5qXwL82j7tDY e+h80Uh5pkUSwXvWuOjQ69U6F8QWAjSYo0UStQzsRoRbwynNS+uMN97Pzc+bWhSRV7jn XBjO0Ktzfm7lbnATPx8XurUAC+UNkTgvxsF3m/AoDEfBaI8Orr1RfkiwaLp0sZwlsfxl zGUmWpRdKPNFmDjAbfrmhb07mlhdLA2Xr3FrtyOpWj3kF7Trk39fO6qhAALRWp9LZYVi rx2A== 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 z6-20020aa79486000000b005e2c94ead4csi295607pfk.121.2023.04.03.19.12.21; Mon, 03 Apr 2023 19:12:40 -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 S232138AbjDDCLk (ORCPT + 99 others); Mon, 3 Apr 2023 22:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbjDDCLj (ORCPT ); Mon, 3 Apr 2023 22:11:39 -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 8BC091728; Mon, 3 Apr 2023 19:11:19 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;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=12;SR=0;TI=SMTPD_---0VfJXedw_1680574263; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0VfJXedw_1680574263) by smtp.aliyun-inc.com; Tue, 04 Apr 2023 10:11:04 +0800 From: Yang Li To: davem@davemloft.net Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, saeedm@nvidia.com, leon@kernel.org, simon.horman@corigine.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li , Abaci Robot Subject: [PATCH net-next v2] net/mlx5e: Remove NULL check before dev_{put, hold} Date: Tue, 4 Apr 2023 10:11:02 +0800 Message-Id: <20230404021102.25122-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 ./drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:35:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. ./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 --- change in v2: --According to Simon's suggestion, add the one in mlx5e_set_int_port_tunnel(). .../net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 10 +++------- 1 file changed, 3 insertions(+), 7 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..2cb2ba857155 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 @@ -32,9 +32,7 @@ static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv, &attr->action, out_index); out: - if (route_dev) - dev_put(route_dev); - + dev_put(route_dev); return err; } @@ -730,8 +728,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 +762,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