[PATCH v3 3/4] PCI: keystone: Exit ks_pcie_probe() for invalid mode

Siddharth Vadapalli s-vadapalli at ti.com
Mon Sep 22 00:12:15 PDT 2025


Commit under Fixes introduced support for PCIe EP mode on AM654x platforms.
When the mode happens to be either "DW_PCIE_RC_TYPE" or "DW_PCIE_EP_TYPE",
the PCIe Controller is configured accordingly. However, when the mode is
neither of them, an error message is displayed but the driver probe
succeeds. Since this "invalid" mode is not associated with a functional
PCIe Controller, the probe should fail.

Fix the behavior by exiting "ks_pcie_probe()" with the return value of
"-EINVAL" in addition to displaying the existing error message when the
mode is invalid.

Fixes: 23284ad677a9 ("PCI: keystone: Add support for PCIe EP in AM654x Platforms")
Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
---

v2 of this patch is at:
https://lore.kernel.org/r/20250912122356.3326888-10-s-vadapalli@ti.com/
Changes since v2:
- The commit subject and description has been updated to keep it concise
  and highlight the issue and the fix.
- A "Fixes" tag has been added but 'stable' hasn't been CCed on purpose
  since backporting the patch isn't required - doesn't enable
  functionality.

 drivers/pci/controller/dwc/pci-keystone.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index d03e95bf7d54..f9f8235ea3cd 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1337,6 +1337,8 @@ static int ks_pcie_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(dev, "INVALID device type %d\n", mode);
+		ret = -EINVAL;
+		goto err_get_sync;
 	}
 
 	ks_pcie_enable_error_irq(ks_pcie);
-- 
2.43.0




More information about the linux-arm-kernel mailing list