[PATCH v5 4/4] PCI: j721e: Add warnings on num-lanes misconfiguration

Matt Ranostay mranostay at ti.com
Wed Nov 9 00:25:56 PST 2022


Added dev_warn messages to alert of misconfigurations for incorrect number
of lanes setting, or the lack of one being defined.

Signed-off-by: Matt Ranostay <mranostay at ti.com>
Reviewed-by: Vignesh Raghavendra <vigneshr at ti.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index 83b8100afaff..f6320ad75587 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -465,9 +465,16 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	pcie->user_cfg_base = base;
 
 	ret = of_property_read_u32(node, "num-lanes", &num_lanes);
-	if (ret || num_lanes > data->max_lanes)
+	if (ret) {
+		dev_warn(dev, "no num-lanes defined, defaulting to 1\n");
 		num_lanes = 1;
+	}
 
+	if (num_lanes > data->max_lanes) {
+		dev_warn(dev, "defined num-lanes %u is greater than the allowed maximum of %u, defaulting to 1\n",
+			 num_lanes, data->max_lanes);
+		num_lanes = 1;
+	}
 	pcie->max_lanes = data->max_lanes;
 	pcie->num_lanes = num_lanes;
 
-- 
2.38.GIT




More information about the linux-arm-kernel mailing list