Message ID | 202211301541270908055@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;heyuhang3455@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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: <zhang.songyi@zte.com.cn> To: <saeedm@nvidia.com>, <pabeni@redhat.com> Cc: <leon@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <mbloch@nvidia.com>, <maorg@nvidia.com>, <elic@nvidia.com>, <jerrliu@nvidia.com>, <cmi@nvidia.com>, <vladbu@nvidia.com>, <netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <zhang.songyi@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_net-next=5D_net/mlx5=3A_remove_NULL_check_before?= =?utf-8?q?_dev=5F=7Bput=2C_hold=7D?= Content-Type: text/plain; charset="UTF-8" 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/<zhang.songyi@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: <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?1750907269184172323?= X-GMAIL-MSGID: =?utf-8?q?1750907269184172323?= |
Series |
[net-next] net/mlx5: remove NULL check before dev_{put, hold}
|
|
Commit Message
zhang.songyi@zte.com.cn
Nov. 30, 2022, 7:41 a.m. UTC
From: zhang songyi <zhang.songyi@zte.com.cn> 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 <zhang.songyi@zte.com.cn> --- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.1
Comments
On Wed, Nov 30, 2022 at 03:41:27PM +0800, zhang.songyi@zte.com.cn wrote: > From: zhang songyi <zhang.songyi@zte.com.cn> > > 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 <zhang.songyi@zte.com.cn> > --- > drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Please change all places in mlx5 in one patch. You can find these with the following command git grep -B 1 -E "dev_put|dev_hold" drivers/net/ethernet/mellanox/mlx5/ Thanks > > 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); > -- > 2.25.1
On Wed, 30 Nov 2022 11:00:34 +0200 Leon Romanovsky wrote: > On Wed, Nov 30, 2022 at 03:41:27PM +0800, zhang.songyi@zte.com.cn wrote: > > From: zhang songyi <zhang.songyi@zte.com.cn> > > > > 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 <zhang.songyi@zte.com.cn> > > --- > > drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > Please change all places in mlx5 in one patch. Your call as a mlx5 maintainer, but I'd say don't change them at all. All these trivial patches are such a damn waste of time.
On Wed, Nov 30, 2022 at 09:25:16AM -0800, Jakub Kicinski wrote: > On Wed, 30 Nov 2022 11:00:34 +0200 Leon Romanovsky wrote: > > On Wed, Nov 30, 2022 at 03:41:27PM +0800, zhang.songyi@zte.com.cn wrote: > > > From: zhang songyi <zhang.songyi@zte.com.cn> > > > > > > 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 <zhang.songyi@zte.com.cn> > > > --- > > > drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > Please change all places in mlx5 in one patch. > > Your call as a mlx5 maintainer, but I'd say don't change them at all. I'm fine with one patch per-driver, I'm not fine with one patch per-line :). > All these trivial patches are such a damn waste of time. IMHO, it is valuable changes for actively developed code. Thanks
On 30 Nov 09:25, Jakub Kicinski wrote: >On Wed, 30 Nov 2022 11:00:34 +0200 Leon Romanovsky wrote: >> On Wed, Nov 30, 2022 at 03:41:27PM +0800, zhang.songyi@zte.com.cn wrote: >> > From: zhang songyi <zhang.songyi@zte.com.cn> >> > >> > 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 <zhang.songyi@zte.com.cn> >> > --- >> > drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- >> > 1 file changed, 1 insertion(+), 2 deletions(-) >> >> Please change all places in mlx5 in one patch. > >Your call as a mlx5 maintainer, but I'd say don't change them at all. >All these trivial patches are such a damn waste of time. I agree, let's not waste more time on this, I will accept this patch as is since it's already marked awating-upstream.. Applied to net-next-mlx5
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);