From patchwork Wed Nov 30 07:41:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhang.songyi@zte.com.cn X-Patchwork-Id: 27622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp788565wrr; Wed, 30 Nov 2022 00:01:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Tf5lVgI0hB5XqCFjtKv6nyVs/pUZwxI34HyqhBS+YvFLt742JAT4SY3S6itDWuoR/t9ZS X-Received: by 2002:a17:906:2ec7:b0:79b:413b:d64 with SMTP id s7-20020a1709062ec700b0079b413b0d64mr33683046eji.538.1669795292935; Wed, 30 Nov 2022 00:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669795292; cv=none; d=google.com; s=arc-20160816; b=y9xci7fW1bhSBxL1oGNR0DPhXaTiFCXCRjt+/qmGkyp57YhuNEBgQ6+wH7RAavM9cQ RqTquuifa4nXbIx9/RhsNH5P1259KPi3uILsQA+NI3RiHywppDdvK+B01ZRO9ehm8Py5 nztnKE7BxC8NnLC9FiruL28BPL6rF7su0P6DDDp715PghaScnSs3QQibj2jD6idn899J kwmdB4m/BcSP3j8e1eKBFic3Uf/0PBc/0QA3jZwUm7Tew5eNUBq3M8rJYkwRKljGRFLZ Lqt2TIA5CaBN0Y7hlhLokVUOHItJL3kWOB2X5GWQEKKDCZMMXnOhDROgJn8lP0PKOBPU R4DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=5o6V/AEdD0ywiEqySwCUpNN819WZqvzl6WSpFVXPHCU=; b=h7Wvoxc1PCFbJI+MHHPn1iiVt1bqtt0yfGLuAceegGql6PTJ/F608u2lOTUl35nORI QuWWvHk03qVXekr3tftPB8TiOV90bjLMziojneso80m82XdW6t+wK6qua6N3Vuv0FMi5 SU+JqUpuTeJkrLoeSEchXzjM7KU2CyW++lExHqx0PWvyieuyyP0cg9RX/tD0GQmJNG+x dr3Sd2NaBkZXwkmtPWCHHp34mC2lBPG0HFWDjUT4wnSh21ehEPPxeXZUHtkUb7ZhVzRM 5kZQZflgH8QUob3mBRVQAYFrUxgT5hBxve32/43E2yA5dlJ0iloxplC0v9CaTuHvBJ0l eM8A== 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=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020aa7c38d000000b00461cdda451dsi708118edq.435.2022.11.30.00.01.08; Wed, 30 Nov 2022 00:01:32 -0800 (PST) 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=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234107AbiK3Hlo (ORCPT + 99 others); Wed, 30 Nov 2022 02:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbiK3Hll (ORCPT ); Wed, 30 Nov 2022 02:41:41 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A04005B5A5; Tue, 29 Nov 2022 23:41:40 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NMWNz0ttpz8RTZM; Wed, 30 Nov 2022 15:41:39 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2AU7fOKX001717; Wed, 30 Nov 2022 15:41:24 +0800 (+08) (envelope-from zhang.songyi@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 30 Nov 2022 15:41:27 +0800 (CST) Date: Wed, 30 Nov 2022 15:41:27 +0800 (CST) X-Zmail-TransId: 2af9638709276644dd5b X-Mailer: Zmail v1.0 Message-ID: <202211301541270908055@zte.com.cn> Mime-Version: 1.0 From: To: , Cc: , , , , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_net-next=5D_net/mlx5=3A_remove_NULL_check_before?= =?utf-8?q?_dev=5F=7Bput=2C_hold=7D?= X-MAIL: mse-fl1.zte.com.cn 2AU7fOKX001717 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63870933.000 by FangMail milter! X-FangMail-Envelope: 1669794099/4NMWNz0ttpz8RTZM/63870933.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63870933.000/4NMWNz0ttpz8RTZM X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750907269184172323?= X-GMAIL-MSGID: =?utf-8?q?1750907269184172323?= From: zhang songyi The call netdev_{put, hold} of dev_{put, hold} will check NULL, so there is no need to check before using dev_{put, hold}. Fix the following coccicheck warning: /drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:1450:2-10: WARNING: WARNING NULL check before dev_{put, hold} functions is not needed. Signed-off-by: zhang songyi --- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c index 32c3e0a649a7..6ab3a6b6dd8d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c @@ -1448,8 +1448,7 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev) } else { ndev = ldev->pf[MLX5_LAG_P1].netdev; } - if (ndev) - dev_hold(ndev); + dev_hold(ndev); unlock: spin_unlock_irqrestore(&lag_lock, flags);