diff mbox series

PCI: xilinx-cpm: Fix incorrect version check in init_port

Message ID 20250311072402.1049990-1-thippeswamy.havalige@amd.com (mailing list archive)
State Accepted
Delegated to: Krzysztof Wilczyński
Headers show
Series PCI: xilinx-cpm: Fix incorrect version check in init_port | expand

Commit Message

Havalige, Thippeswamy March 11, 2025, 7:24 a.m. UTC
Fix an incorrect conditional check in xilinx_cpm_pcie_init_port().

The previous condition mistakenly skipped initialization for all
versions except CPM5NC_HOST. This is now corrected to ensure that only
the CPM5NC_HOST is skipped while other versions proceed with
initialization.

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Fixes: 3f62f3280275 ("PCI: xilinx-cpm: Add support for Versal Net CPM5NC
Root Port controller")
---
 drivers/pci/controller/pcie-xilinx-cpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof Wilczyński March 11, 2025, 7:27 a.m. UTC | #1
Hello,

> Fix an incorrect conditional check in xilinx_cpm_pcie_init_port().
> 
> The previous condition mistakenly skipped initialization for all
> versions except CPM5NC_HOST. This is now corrected to ensure that only
> the CPM5NC_HOST is skipped while other versions proceed with
> initialization.

[...]
>  {
>  	const struct xilinx_cpm_variant *variant = port->variant;
>  
> -	if (variant->version != CPM5NC_HOST)
> +	if (variant->version == CPM5NC_HOST)
>  		return;
>  
>  	if (cpm_pcie_link_up(port))

Ouch!  Nice catch.

I will pull and squash this against the existing code directly on the branch.

Thank you!

	Krzysztof
Havalige, Thippeswamy March 11, 2025, 9:58 a.m. UTC | #2
[AMD Official Use Only - AMD Internal Distribution Only]

Hello,

Thank you.

Regards,
Thippeswamy H

> -----Original Message-----
> From: Krzysztof Wilczyński <kw@linux.com>
> Sent: Tuesday, March 11, 2025 12:58 PM
> To: Havalige, Thippeswamy <thippeswamy.havalige@amd.com>
> Cc: bhelgaas@google.com; lpieralisi@kernel.org;
> manivannan.sadhasivam@linaro.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; linux-pci@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>;
> Gogada, Bharat Kumar <bharat.kumar.gogada@amd.com>
> Subject: Re: [PATCH] PCI: xilinx-cpm: Fix incorrect version check in init_port
>
> Hello,
>
> > Fix an incorrect conditional check in xilinx_cpm_pcie_init_port().
> >
> > The previous condition mistakenly skipped initialization for all
> > versions except CPM5NC_HOST. This is now corrected to ensure that only
> > the CPM5NC_HOST is skipped while other versions proceed with
> > initialization.
>
> [...]
> >  {
> >     const struct xilinx_cpm_variant *variant = port->variant;
> >
> > -   if (variant->version != CPM5NC_HOST)
> > +   if (variant->version == CPM5NC_HOST)
> >             return;
> >
> >     if (cpm_pcie_link_up(port))
>
> Ouch!  Nice catch.
>
> I will pull and squash this against the existing code directly on the branch.
>
> Thank you!
>
>       Krzysztof
Krzysztof Wilczyński March 11, 2025, 2:50 p.m. UTC | #3
[...]
> Thank you.

Done.  Have a look at:

  https://web.git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=controller/xilinx-cpm&id=ad3b7174d4d04b7e2ab81df5857c4da6b4bc1ade

Let me know if there is anything else that needs an update.

Also, if you have a moment, then check if the other special cases for
CPM5NC_HOST variant are correct.  Would be nice to catch any issues
before the changes land in the upstream.

Thank you!

	Krzysztof
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
index c2dd6fda905f..d0ab187d917f 100644
--- a/drivers/pci/controller/pcie-xilinx-cpm.c
+++ b/drivers/pci/controller/pcie-xilinx-cpm.c
@@ -479,7 +479,7 @@  static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
 {
 	const struct xilinx_cpm_variant *variant = port->variant;
 
-	if (variant->version != CPM5NC_HOST)
+	if (variant->version == CPM5NC_HOST)
 		return;
 
 	if (cpm_pcie_link_up(port))