Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp160177lqm; Tue, 30 Apr 2024 16:46:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXiOvbSa1GiemvmthHfjwP4V64TQ18lVx6V/YfgtU0Tgcesi0zXb1VCxR87fYp9xhjvAXsZUyKMKMVOIXhredqbgCChGk4yFGdEZ5+sLA== X-Google-Smtp-Source: AGHT+IGKnygBWiMCZJ4iGB6yiWLrKdeuAmLy1QFqmNbytKZRfYLxPCl3Oyp0BNfJgyD6v5Pckr29 X-Received: by 2002:a17:903:41cf:b0:1e4:6cd7:30b3 with SMTP id u15-20020a17090341cf00b001e46cd730b3mr1600520ple.23.1714520817179; Tue, 30 Apr 2024 16:46:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714520817; cv=pass; d=google.com; s=arc-20160816; b=urmeeZHyhCVdJg5DgCOfDbpukz7uakUmlmruhokk3lO+Ah4/RXNYSBQ7PQzTHxXM58 Un9VI3ahiwSj+Nuq+EMr/dZrQNrFx+mo+WURqjxoYoQhDU/YcR4Yslzu6cNyxUtZFvYA fPWFY23SE/k/El+GH/ao1yhFZxdPMJf2dHCw6mpeCG5i41z7X6u2bScElvQ/yr6gHDh3 XF5s1RSwcHwDdNvEtR0otkmydgOgDNDl5/gHmQjpjmsRO2rzIE9fhZPmeTGpsnOmvJEs I6Mx44z+vqD2TzEVmSPQSC87lY5MXTly0vS7cSf0XFxQPTa9Yy1rddtcGm4s5BUCMjXk CGaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=PugqrNxdjGjwJFTS0LZE4hIzxF1okCPNtGWxtNNqIdg=; fh=o0jeaaYpd/3rJAGzrStcx6WrFBa5ZW2Ia29Was6h3Ds=; b=CT1Ufg/FsKjIeFWf3Cp3Tn2U+JRml++y9MM+hO3jwvw9Qxg2f8HoYX9+SrmKxcnXWO xtb9H5+zcvBOS6EmOUamB1LVCUGmV+Qq7FCYpbS6T0CpMTN+1tJsQNpYslbSR3uGQ/nI nqwQbF1h1Yv5+mljjXPZtwKCtUnCMJIYnzO1ZB22ljk+cRafayYdG518FDDUciEqS8y8 CtfF+LtPlyYERo2VddMcbfyPhON38SCMqrlKdlV0vKn+NWefoYBqdVOht1zIeXp8nXg4 I+gkHbjXVAHqvLhkI+1bcjfb0PXX/0MhnU2NRMRUXQETlD21ZuWoXsw0rzOgvKEK8qHO AltQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QVBxbu0m; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-164802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc14-20020a1709032b0e00b001eb7c9450bcsi6505245plb.355.2024.04.30.16.46.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 16:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QVBxbu0m; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-164802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CFA2F281BDB for ; Tue, 30 Apr 2024 23:46:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EB9D1C0DEC; Tue, 30 Apr 2024 23:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QVBxbu0m" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB271C0DD3; Tue, 30 Apr 2024 23:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714520808; cv=none; b=RxVRdcIKT2WE9WDBPjN0ov3MsSmZ2LvhmZQT6hwJTy8yWFZvKgTmU99sp6lHeMPeZtdRfnzr4T3263FGu0v9owbptZ7LHs3SnnvYhW/InPIyyzRPOgkC+15Fj+NmmxTpxn/iqpF2SJNDqhuOwvPDvGqFMGw2lca/d4sf5x61P54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714520808; c=relaxed/simple; bh=5F6ZplCAmEgFgPquJv3INfjuKSpwKrq4QVtlp6h2kDA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=hYPlNb6eCHDvrIYsn2zDw6KO10P2Nn7lzgUTxNSBFbjBBfWEWLcu3/AFkW+mB0DgW1wOzBYD0riSp0KUmWQvYLevKtemN2jWmELjKDQ5ZYqgpKxcBeu285/d5pJsxUMEFxLymQagxJOF8t6YIzmTu3SD9tAwmLnB6Lw4aFxsOAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QVBxbu0m; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-41ba1ba55e9so35573025e9.3; Tue, 30 Apr 2024 16:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714520804; x=1715125604; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=PugqrNxdjGjwJFTS0LZE4hIzxF1okCPNtGWxtNNqIdg=; b=QVBxbu0mEFbVb0kkOKcNMaesSvD1Q1buvIWrVnsujEvDi8IdcbT4UmjjDz/K4R2KLG YaZ+Fh/LH5oe64TpXOlP/RD8D/Z8v3ioxVmhbbrTkF37OYho2b/8TSi1wmEOR6QamAas 4YzP+ETxq5cO6Hryyx9GCal4tCaxhTtXXF08x+9I2YyxXJ7dTEhX9sTDtzbLHO8KM7sj AQO7F6wASGzfWJg0JuDrQ+oNsqXHnl+uPcxvGeiHdd2GBWywDUoF/T/c/K/LNcaWQUDd LCtYrtsjTNFAbgI4SnQWE5S506cL3/nr7TzFLTWQR1IJ2a+6wFZL9gWoQTAJdlXVEzFV Xv6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714520804; x=1715125604; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PugqrNxdjGjwJFTS0LZE4hIzxF1okCPNtGWxtNNqIdg=; b=e0+Cjt7MrfK1sasrEr/HJUpz9mTHWPsl6CiQqRCaqd/xSEUzNvyC9FMLP1JYtka4gu hjyAjbJxOKFX3JX931wYuXidU5ARBrjRgV3/zfe9Pvj9ejCwCb05muvjPnXlaSf2Qc7t 8fqQwl7Pgb8Va4kdAMDYW7Usgg2Wf08lccbOc3t9xNfMSJYUjnYV1iKw6Lzh+U7/kO1/ jO/BnkaBSrwFqCbKMVvYkX1z+iOpe9hLJwVKTPujhrNfGnT3ojh926BeHoiwQyidnRyq ymVTGgaGBeuGTBe8My5ChBYYdJ2ox0qtQziyC3eLPexwp3wztdDFL6j5gRbsyg9JR07V EICQ== X-Forwarded-Encrypted: i=1; AJvYcCXVl5P8N0Y9TdDjyh00ZB4LTM+++A5YodYLFGVwHbLJSOMTu9onjkgKSUXYaWHipZwResRZM+DVSiFWrE/bRCtpDeb1VgyLR+RVi/ikzDq3nGWTk4aTt9tHjyHDmWZ/51oeX3OmIKOXzA== X-Gm-Message-State: AOJu0YzLRf92/Ng91M12q889qjYG2KbwYc28Aqv5X74JIzy6SAyZz7jA iCbH7/FbXcV3+iCq3kaCqPqzr5aNALQM74TsQZj4Vd7zxW/x/SM= X-Received: by 2002:a05:600c:4744:b0:41c:11fe:4de3 with SMTP id w4-20020a05600c474400b0041c11fe4de3mr598642wmo.24.1714520804380; Tue, 30 Apr 2024 16:46:44 -0700 (PDT) Received: from octinomon.home (182.179.147.147.dyn.plus.net. [147.147.179.182]) by smtp.gmail.com with ESMTPSA id v17-20020a05600c471100b0041abdaf8c6asm400181wmo.13.2024.04.30.16.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 16:46:44 -0700 (PDT) Date: Wed, 1 May 2024 00:46:42 +0100 From: Jules Irenge To: leon@kernel.org Cc: jgg@ziepe.ca, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, lishifeng@sangfor.com.cn, gustavoars@kernel.org Subject: [PATCH] RDMA/mlx5: Remove NULL check before dev_{put, hold} Message-ID: 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 Coccinelle reports a warning WARNING: NULL check before dev_{put, hold} functions is not needed 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/hw/mlx5/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index c2b557e64290..2366c46eebc8 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -264,8 +264,7 @@ static struct net_device *mlx5_ib_get_netdev(struct ib_device *device, */ read_lock(&ibdev->port[port_num - 1].roce.netdev_lock); ndev = ibdev->port[port_num - 1].roce.netdev; - if (ndev) - dev_hold(ndev); + dev_hold(ndev); read_unlock(&ibdev->port[port_num - 1].roce.netdev_lock); out: -- 2.43.2