Skip to contentSkip to conversation

PCI: cadence: check the correct variable

PATCH In review Dan Carpenter 2 participants 3 messages Sep 19, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: cadence: check the correct variable

We should be checking "phy[i]" instead of "phy".

Fixes dfb80534692d ("PCI: cadence: Add generic PHY support to host and EP drivers")
drivers/pci/controller/pcie-cadence.c +2 -2
index 86f1b002c846..5e369dd183c8 100644
@@ -191,8 +191,8 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
 	for (i = 0; i < phy_count; i++) {
 		of_property_read_string_index(np, "phy-names", i, &name);
 		phy[i] = devm_phy_optional_get(dev, name);
-		if (IS_ERR(phy))
-			return PTR_ERR(phy);
+		if (IS_ERR(phy[i]))
+			return PTR_ERR(phy[i]);
 
 		link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
 		if (!link[i]) {
#1 lore raw
Quoted 10 lines · Dan Carpenter

We should be checking "phy[i]" instead of "phy".

Fixes dfb80534692d ("PCI: cadence: Add generic PHY support to host and EP drivers")
drivers/pci/controller/pcie-cadence.c +0 -0
index 86f1b002c846..5e369dd183c8 100644

drivers/pci/controller/pcie-cadence.c int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie) · line 198

Quoted 10 lines
drivers/pci/controller/pcie-cadence.c +2 -2
@@ -191,8 +191,8 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
 	for (i = 0; i < phy_count; i++) {
 		of_property_read_string_index(np, "phy-names", i, &name);
 		phy[i] = devm_phy_optional_get(dev, name);
-		if (IS_ERR(phy))
-			return PTR_ERR(phy);
+		if (IS_ERR(phy[i]))
+			return PTR_ERR(phy[i]);
 
 		link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
 		if (!link[i]) {

Alan,

technically, patch (that I already queued):

https://patchwork.ozlabs.org/patch/966547/

fixes this issue; in theory we should split it in two patches to first do what this patch does and then update the _get() API but I think it is overkill. Do you want me to squash this patch log into the patch above log for completeness ?

Thanks,
Lorenzo