Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1131969lqb; Thu, 18 Apr 2024 00:31:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX84Z8T/Pv70VXOBJ3EONhUJ3RJEEbBWvgptaytZw+pQSf71z2lX4vSFlupTxBaYZ0PENDwg9XY3gvAFK4doQhEajgMC0tqynklhjCNvQ== X-Google-Smtp-Source: AGHT+IGSgxUE5KLOsinn0U/w/b9V7hGDv7IZgG1+OpcdsHfaxBPMBbHANp9SAnDkFxbRExhhUQWH X-Received: by 2002:a05:6808:15a9:b0:3c7:609:246f with SMTP id t41-20020a05680815a900b003c70609246fmr2785211oiw.37.1713425511471; Thu, 18 Apr 2024 00:31:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713425511; cv=pass; d=google.com; s=arc-20160816; b=TnH47axrNNOT7Nea604mNxrRIJatH1g4J10vvFoUOyiCy0l2Dn9Wm4X8qfxc6qaHA4 /LMJFbnrxo/H7FV+3Yjk16iRwemxI3fFd087CfnbJnHg8yM1/wZjNBDFz123r004rzea t5tAXGjPIXLsCVvW+fuKtK9mYAsr6yQokbDatJh2HA3j6kccPNIBGIWHbCOZS324cXz7 rb488/aJ/stVaxemUByzRIGNDJnUYxhxLWWlfkft/ppyBhr0KrCOFwWuxbHnrpkg1YSI sEIMAL47J92ErTifayi5G74V+9XVu1Bpt7HgB4vY4S8Dnhbxej+DOy6TEoamJCRCxuXR 6xyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9KH/0gX4nuEqY5M5Shgab8r86I8FtVQ44AsXqRTnb4U=; fh=LErwvr2Ha4hjEyIGuJ9J3Bp8Xtjg+0S3KH+AanIHeT8=; b=WAR0I9yCccfNlmmq2VzSX6o6bD9fiNmDwirv+g+j415RO5I649Y16uKIHfN2ZlaWc7 SzLujN+iRygqWR5J+NFSFn7P8yHhRDc7+gXqicIulFAEuODBlj47Uu4g1zYXsBs55DyB rmlk7Jk1whmc/GvTGX2QET/Y9BeyRUUyIEGAjPvzDdeUhNTNib5gsTQT7ubELUu1MVPO PLXeySLmL7Lh/OUAYNFBC0WEx3n7wYA4rL3fDGTS4sXvaP6/4AXY8HqWvs5u8DiHs0Um KGYPvMyFTLPPgHrD5ddg1cQXz10FuEz9M0LAKBcJF51s88t0IOBjFw/Bm+E+1kstpzKg B7lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BuNnMXTQ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-149651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id g9-20020a63e609000000b005f066656fc1si870002pgh.522.2024.04.18.00.31.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 00:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BuNnMXTQ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-149651-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1EA25B215C6 for ; Thu, 18 Apr 2024 07:30:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F9DA757ED; Thu, 18 Apr 2024 07:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BuNnMXTQ" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 23FC36A343 for ; Thu, 18 Apr 2024 07:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713425431; cv=none; b=OyLSbWJlXLCLMPYL6y56ZoNW3S4ovYOF2dUoodqE7yuzxNhqXMFtrZ00YYZe0WdzSC+C3LNG2xHF5xG3IzOUvIQr28ux5cZDEsP8vcXriaDXPnl2POv55Ul5AgSen1Rb5aK8O65/c9kz547FSIaSGKsG0h3LmV/qnPOqPQ2a/OA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713425431; c=relaxed/simple; bh=jo84Ctj+EJCX1GrpA4pW6fdXW7pDWtjFx80MeyJrxQo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z9OdIu6LXLpO4dPAys4N+4WgOwm89ZQkXkXyjeat+8KMTyYEVQzt5wLQq8TgBvPCgOl8gRKGwkSmLY6UDHjDxHSyZvERc+2qsIjSrI6aXSgpzay9HjGcbUKEQ77NFgOxaPZzRuoKmhmYeIBeVxAWP0ZzUnJNyTOApmNwtkQAGG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BuNnMXTQ; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e4266673bbso5356655ad.2 for ; Thu, 18 Apr 2024 00:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713425429; x=1714030229; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=9KH/0gX4nuEqY5M5Shgab8r86I8FtVQ44AsXqRTnb4U=; b=BuNnMXTQIDEJKUWx/2aFeg9hs86yWeNWfbs9fWr3NUfPHz4ZZ6bsaUF0AwI6OSZdKW F9glOIhvsv4vQJ07yZg9yCaGrqNkPqhqn/h9XqDhKRHTUUL+fKC4sITH+Lg9It1tW8l4 oJG7wbB9Yx+x9VFci1TsNejc+PCU5kI4LOLHFtXneaM5Ofuif9XgNPWbIXnvEM1d7vxU rZCgh2An6ORg8y5C92Io7bsjGO+q5+Md0itODxUk1boEmMTwvs5+2H9dM3dq22v7l6AF ccBpLM7YHwXqcqEf321Ml0GflvY6gqVnLkwWWIyZMZzzzlqCAVJCkuh+9g/iRvKT1XHj cbjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713425429; x=1714030229; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9KH/0gX4nuEqY5M5Shgab8r86I8FtVQ44AsXqRTnb4U=; b=LJEVuk3liIQeSTQPfvCWa+nCSlXJPKGKCaQbj2qm8FR3lbIgyCzhHW0VuQW6RxesR3 LCEJmAIUsQlr1XrCJ2p/+qQT0G8/5uckLtt28J/1b2/89tblIBuamBrj3lZIMYl+hc2T +gRSPms6Hakb5GxCiON+SnjvlR4uz+5R3pTybpJQMlYCk/LT+8wHvnBAGUhvplPZ1wZ2 i/rY0H7QBVzdhFq0VqSoLJ5cqvr4rZyXkqjlJRsmu6hc0fedWGwL1lvDNjEfmHErGqa1 l6QNf7fEVWMKD4Tk94QjA54VK4yHQCOaCuddvtZIcpqhVTPkSpLMUVpR6RL8FUPqNQT+ RmUA== X-Forwarded-Encrypted: i=1; AJvYcCXmbVKle6xMzFzb3EhMe8EKlJyuZrk49Ok6btpWN5VDDv5oZCl9MJCVf53kVD03INzTk3xm9MEUX3KJ+fWOVoLN7SzjgoQKhLCodp6h X-Gm-Message-State: AOJu0YwqFicdLsRYB8AkDo3bCBL8wDmtkl4eFpDyMcRyVFg/fhD1qeB4 wRu6SF6R2AToHlW//jJ9q8BYAsZ7Dgm+D3FVY98AOUKvUdM2JHSI3XMgRaKLhA== X-Received: by 2002:a17:902:da85:b0:1e1:6850:f823 with SMTP id j5-20020a170902da8500b001e16850f823mr2668391plx.13.1713425428965; Thu, 18 Apr 2024 00:30:28 -0700 (PDT) Received: from thinkpad ([120.56.197.253]) by smtp.gmail.com with ESMTPSA id j23-20020a170902759700b001deecb4f897sm837286pll.100.2024.04.18.00.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 00:30:28 -0700 (PDT) Date: Thu, 18 Apr 2024 13:00:23 +0530 From: Manivannan Sadhasivam To: Niklas Cassel Cc: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Carpenter Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Make use of cached 'epc_features' in pci_epf_test_core_init() Message-ID: <20240418073023.GA4331@thinkpad> References: <20240417-pci-epf-test-fix-v1-1-653c911d1faa@linaro.org> <20240418054319.GB2861@thinkpad> <20240418065308.GG2861@thinkpad> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Apr 18, 2024 at 09:14:23AM +0200, Niklas Cassel wrote: > On Thu, Apr 18, 2024 at 12:23:08PM +0530, Manivannan Sadhasivam wrote: > > On Thu, Apr 18, 2024 at 08:46:47AM +0200, Niklas Cassel wrote: > > > On Thu, Apr 18, 2024 at 11:13:19AM +0530, Manivannan Sadhasivam wrote: > > > > On Wed, Apr 17, 2024 at 07:49:45PM +0200, Niklas Cassel wrote: > > > > > On Wed, Apr 17, 2024 at 10:47:25PM +0530, Manivannan Sadhasivam wrote: > > > > > > Instead of getting the epc_features from pci_epc_get_features() API, use > > > > > > the cached pci_epf_test::epc_features value to avoid the NULL check. Since > > > > > > the NULL check is already performed in pci_epf_test_bind(), having one more > > > > > > check in pci_epf_test_core_init() is redundant and it is not possible to > > > > > > hit the NULL pointer dereference. This also leads to the following smatch > > > > > > warning: > > > > > > > > > > > > drivers/pci/endpoint/functions/pci-epf-test.c:784 pci_epf_test_core_init() > > > > > > error: we previously assumed 'epc_features' could be null (see line 747) > > > > > > > > > > > > Reported-by: Dan Carpenter > > > > > > Closes: https://lore.kernel.org/linux-pci/024b5826-7180-4076-ae08-57d2584cca3f@moroto.mountain/ > > > > > > Signed-off-by: Manivannan Sadhasivam > > > > > > > > > > I think you forgot: > > > > > Fixes: a01e7214bef9 ("PCI: endpoint: Remove "core_init_notifier" flag") > > > > > > > > > > > > > No, that's not the correct fixes tag I suppose. This redudant check is > > > > introduced by commit, 5e50ee27d4a5 ("PCI: pci-epf-test: Add support to defer > > > > core initialization") and this commit removes the redundant check (fixing smatch > > > > warning is a side effect). So if the fixes tag needs to be added, then this > > > > commit should be referenced. > > > > > > Well, you have a Closes: tag that links to a bug report about a smatch > > > warning that was introduced with 5e50ee27d4a5 ("PCI: pci-epf-test: Add > > > support to defer core initialization"). > > > > > > So if you want to reference another commit, then you should probably > > > drop the Closes: tag. > > > > > > > Then checkpatch will complain... But I think I can keep the two tags? One is for > > fixing the redudant check and another is for the smatch warning reported. > > Yes, I think so too. > > You can have Fixes: to the commit that introduced the redundant check, That is 5e50ee27d4a5. > since this was obviously not the correct thing to do, and then perhaps > just mention commit 5e50ee27d4a5 ("PCI: pci-epf-test: Add support to > defer core initialization") somewhere in the commit log. You mean a01e7214bef9 here? - Mani -- மணிவண்ணன் சதாசிவம்