Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2019458lqa; Tue, 30 Apr 2024 06:23:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVv+Lk67Hya7da0IUrKpNfRfTr/j/eq11NIJrafkxWC7MFhuuN1PuUwXm5PAX9QYANsFv46t4PqLwTHGfvg3NgJnGRIjHUFoE31M9ZMlg== X-Google-Smtp-Source: AGHT+IEyjUpoRdZJXwOFdiapXa+lkzZZ92kQ+isxQbQVUWjY55FhlZfgIVwO/O1NnoJr5v7pYQZw X-Received: by 2002:a05:6214:3012:b0:6a0:590e:d616 with SMTP id ke18-20020a056214301200b006a0590ed616mr2679699qvb.29.1714483394278; Tue, 30 Apr 2024 06:23:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714483394; cv=pass; d=google.com; s=arc-20160816; b=V15HJE/C0BLeYVqXXna8Q7bIaGgr5VswgvpTV2bq7OceR1nBRlhOJG02Y1CHgIlVbi soq5elwo/dcli9K5Pdz82taBYwsGbdVgv9FXnObRU+FiCqmdlfPVMnPNr1DSP/Vplgxn 4I37cM82CcAcY3K4ULPDOYEW1X0XQds3T/kHP4o126BGvqPECaJN/Wg8+mfFIhRxvuxg 0am28D4+PjMAXfGwqPOG7Am/w4T4IVqc0XQsHBZZjOGTeGh9hKpBxrAi7BX/44URu9pO HSa830wUGGPmgM3RDdfpjY2tcQOvHCfMw/jAidfaB98Dxg0SZGi89CWNkscz6iCOu9PZ 8xZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NnNmlQ+ST2y67TJCgA+o+HjhhMaf5OB2+0CM4dSjkWc=; fh=FaEsamqaA6IlBtIkR8DBLSiBzlRqhxs15teFNeX5zxo=; b=sOyk7dNl16psGdkY0YY1RqB716cs9SvYh1sGOZGiTnjooieP+OW2cRHOf46uO8AUzl 8RCJvaFTUpsUDNYZ6embI7/Z4xXp2/q2/UdReO4miL6ewLjQ34v0U4KQ43Z1+Mbg1Kpp /9fYc2CkysdTWyqPSNpdDrkHDvp07TgBowdUwkfF2Zu5QE7yZkXKQE2qQajpI5QhCJx2 gHgbuCVC4NwalYQ/QTSivrRYYlPQz+tKM9HgtqNQlyZCB2pL/D+IzdVR+IaoMgHMgrYR 13+twEaV2vTwE4oeTWOzPYMHT2fYNy9gZD0RQloACjxeRoAnF+Z0IxIglSeV9S7V+wRW /iRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qyzanMcW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163993-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eo6-20020ad45946000000b006a0ba3800e3si7729345qvb.481.2024.04.30.06.23.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:23:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163993-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qyzanMcW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163993-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 04B631C21DE1 for ; Tue, 30 Apr 2024 13:23:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 17CDE171E48; Tue, 30 Apr 2024 13:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qyzanMcW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36D9117166C; Tue, 30 Apr 2024 13:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483297; cv=none; b=XckK2s864zjRej8zmlG4B1iQxEYpNvbf/+ppVdEpKK2XwQmYlCPbb1BndlPu4vgSVO7hEVD3QUvqWE16uVATXad7AUf+WhmmsDWtgorbHKGIZqL0AO9+ri7b+HcoU5SXMtAy9qvPnyVUBjtVbdV+pB8N+W4G5XQcNMtfzKP2DPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483297; c=relaxed/simple; bh=AKOQrcJJa/PgvbmB77Ei3e3Xgp/1RKlFobDI2jRg6yo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bysgEpELKCGP4p8vyo/CmWif4eLnrXXSE+tl2hcPRnmONYahId03pSbG9X68kttYZ1sZy0U62qTjff1x8CtVJxBxMJF0YHKNAMZ7aNYV5nzMmrdwEpKP0mXzfIzx9e2w3a8CxJu+e5uFrDbtFEqlRD+0U+QBnlBR+FhziB72VVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qyzanMcW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC06EC2BBFC; Tue, 30 Apr 2024 13:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714483296; bh=AKOQrcJJa/PgvbmB77Ei3e3Xgp/1RKlFobDI2jRg6yo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qyzanMcW2Zm9XUgr42I5Z8b8OLIWBd2L66oIpnphw/6Nluus4g86N8cM1gDqAkjlq TqgBq7dJl2TIqNG8GSYb4rAHl38ExSRwEZIk3VclKSgbVRhWQH+H3UNfYs210gETdN ENoKl+tgTzIbTcdwWWOzvtPZ1r8bJNdJi7uPg0TEd3YLjYaxzh3Yws0TvvIIaREDLZ hl5lVLiUDtlbYTa3Hj7aGoHyvk3vQ/RN7xZL14eBBxXUtCZJOYBC7ZB5G3nMQOXo7X M3MR0Z3iqini8O36heR4U3aKWaxp1WTW/wPjL2Yeq2rwONvIocUAE7wJNgoXJyywRx dLIRke2GVGDvQ== Date: Tue, 30 Apr 2024 16:21:31 +0300 From: Leon Romanovsky To: Jules Irenge Cc: jgg@ziepe.ca, wenglianfa@huawei.com, gustavoars@kernel.org, lishifeng@sangfor.com.cn, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/core: Remove NULL check before dev_{put, hold} Message-ID: <20240430132131.GG100414@unreal> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Apr 28, 2024 at 02:34:56PM +0100, Jules Irenge wrote: > Coccinelle reports a warning > > WARNING: NULL check before dev_{put, hold} functions is not needed Please do it for whole drivers/infiniband/core in one patch, please. > > The reason is the call netdev_{put, hold} of dev_{put,hold} will check NULL > There is no need to check before using dev_{put, hold} > > Signed-off-by: Jules Irenge > --- > drivers/infiniband/core/device.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index 07cb6c5ffda0..84be4bb9b625 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -2235,8 +2235,7 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev, > spin_lock(&pdata->netdev_lock); > res = rcu_dereference_protected( > pdata->netdev, lockdep_is_held(&pdata->netdev_lock)); > - if (res) > - dev_hold(res); > + dev_hold(res); > spin_unlock(&pdata->netdev_lock); > } > > -- > 2.43.2 >