PCI: dwc: Return directly when num-lanes is not found
authorHou Zhiqiang <Zhiqiang.Hou@nxp.com>
Tue, 20 Aug 2019 07:28:49 +0000 (07:28 +0000)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 22 Aug 2019 17:16:24 +0000 (18:16 +0100)
The num-lanes is optional since it is not needed on some platforms
that bring up the link in firmware.

The link programming is based on the num-lanes properties (which is
optional); if it is not present code must return instead of fiddling
with the lanes value to print an error message.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
drivers/pci/controller/dwc/pcie-designware.c

index 7d25102c304ca1eb87353c6d808c5768d7f4cd17..0a89bfd1636e34b0bc20fc2e07f308845cb87111 100644 (file)
@@ -423,8 +423,10 @@ void dw_pcie_setup(struct dw_pcie *pci)
 
 
        ret = of_property_read_u32(np, "num-lanes", &lanes);
-       if (ret)
-               lanes = 0;
+       if (ret) {
+               dev_dbg(pci->dev, "property num-lanes isn't found\n");
+               return;
+       }
 
        /* Set the number of lanes */
        val = dw_pcie_readl_dbi(pci, PCIE_PORT_LINK_CONTROL);