Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1125160lqb; Thu, 18 Apr 2024 00:14:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGsL3ezHQdz/93cS4o/BVWjyrC9HOgDPnjhzE7gDLUb9GF33rTUvvECD2RcDIoltRNoUN+w7EthOjNJEm8X5ofKG5iHPLLQ4ySgV7gIA== X-Google-Smtp-Source: AGHT+IEfg9FLfYM3OJ/NXNiQu8wzXjXp58QZvhR7raDaBLL0g6WItXvY0LcPGjrlVM6eQqE7ZnYN X-Received: by 2002:a05:6a21:3381:b0:1aa:6ddb:4adf with SMTP id yy1-20020a056a21338100b001aa6ddb4adfmr2673987pzb.39.1713424483006; Thu, 18 Apr 2024 00:14:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713424482; cv=pass; d=google.com; s=arc-20160816; b=V90ScPndJIWj0ANlKElZDoCBVBHxHS1vn1cQacXXGd1pxreaaYevJE9EFamW9Q6K3I fCfmgK0ZzcpHnTVyvm789cKTsArgyftAvVZ1PEp6qOvVSrHVDnh2klIPR4z8YQqDd0vw wTfOMkcl1GH7h2mll/1w/NVyu1BGzH+a+w8ro/19DryjPvKuplHvSGpV86MaSGJdZkwm ufvDU8OBi/rpEaKZ75uiB/lM3FRLPqVow98hBv6ARUawhRUhEmjqprHw2TSvmFrEk3OV sMQYKLBT2QGgFlRt1WTG6qknloEojeAlmlSUqK9/GGT+F37CMwHO36TUB46vzzWeGzzk tnlQ== 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=KQEepSVZY2lXW/LgOls+mB/RHI87Ts9WcNUqfk/QSEo=; fh=84Lm60alC1gOD3/xwRV6wwH4oEpbIf/mN0IM+FxHkpw=; b=VlsObUE5+px4YT7JR05IEq7YFarR8eeQ+TP+F4rUytU5uXt61a717+baKUImj92tGu vzaBHpLJypV80+w7DK6ZXNTkQ1jBMony8CXDudVzafv/Ah3RXu5cddT+gmDOPFSqiJ0F U9ar6W/sK6jrarXeqqHV1zHddJvQ3qcWzHwuGh2HYhUgt/kXySIbnnG1J4br6pqMxbV6 QHMq88ka/4tw25uMqB4ic6rcVVrDasVo7dEjGX+mXsQQ9OQOM3fdEjasD7saFyUYm2ZH 6BaC11gP2Iom3erUGoPFgpnZGDhhIwW2blJMjY3RcIRGGtVe5bzCed0wr44fn2oDI9eZ VRhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QGNpDcr2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-149636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z13-20020a637e0d000000b005f0a54b55fasi912459pgc.817.2024.04.18.00.14.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 00:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QGNpDcr2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-149636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149636-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 488B8B21D26 for ; Thu, 18 Apr 2024 07:14:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 727E83C482; Thu, 18 Apr 2024 07:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QGNpDcr2" 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 95C6625777; Thu, 18 Apr 2024 07:14:28 +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=1713424468; cv=none; b=gYzxaHIn2UUXPwtYp/1pPtw/WQBbuB+vu77ahXaXKYeXk2Jhwk5QCGYml2y+r94zpKfEsgxgH6YdIjYc2xnKZP1JJzA6FFWT84vxOfqa/fNXMAoLkWfz6jD+q9ApepJPS7dT93KV+VhNwDaBbXHaxtdk/rTbnQnm8SRVlo3+ffg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713424468; c=relaxed/simple; bh=4BQPv4B/v1j+fulAMYhGvhNNxdk2a/dTI7NYJ6+EHd8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tvA3KHM4bvc6mYKJf/0czQcJ5U6I6LSUSgwdRNfpoALsalmJsrLk0MRKylOTa6GQbm5psVg+/qIj09ELB/KiU2T7NDOEyjJiUFz60jsCzfK+GCRQ53Jj8ev8c9GhdJMEYIEy+lCemc1yfqqxHN5oz3XbW/J4vkg9Ca0Eisz0Hv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QGNpDcr2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B494FC113CC; Thu, 18 Apr 2024 07:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713424468; bh=4BQPv4B/v1j+fulAMYhGvhNNxdk2a/dTI7NYJ6+EHd8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QGNpDcr2tnGzZGRThhoDFSt0Q30d7Xag0KLEq7A9MABYm0Y6b/GhE/EibYVpcG/FL dOTHndzhk9eXC+45+n/0rmelN06A1PZM2OihZ4Egq4fSETFREPHDvNIvKBpI3z4+pP avV8ZHCcoCCco/V4vzRZmQkdPxFPOK9eGhY5pnVrWvPmopcKZcE8aTNpwvGA3WskGL v1bbuhV0XR4z9c8n6cU2q99vlvP/8z8ARxfPhaPhGNJhiQPrtiX+HWJ0SZcQ/UUD1T xYeoKuif/U1Yr505oqrMad44TH7QsBkC11rFi1SS5Kv/QHbhrspRIq5m+Nme6Gouc+ qiHE7saodJMUg== Date: Thu, 18 Apr 2024 09:14:23 +0200 From: Niklas Cassel To: Manivannan Sadhasivam 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: 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=us-ascii Content-Disposition: inline In-Reply-To: <20240418065308.GG2861@thinkpad> 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, 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. Kind regards, Niklas