Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe

Reorder the PHY creation in the axg-pcie probe function to ensure all
the resource is mapped before creating the PHY. This change addresses
the issue where the PHY creation was attempted before
mapping the necessary resources, potentially causing failures.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250410133332.294556-7-linux.amoon@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Anand Moon and committed by
Vinod Koul
bdeff6d8 fef364bd

+5 -5
+5 -5
drivers/phy/amlogic/phy-meson-axg-pcie.c
··· 136 136 if (!priv) 137 137 return -ENOMEM; 138 138 139 - priv->phy = devm_phy_create(dev, np, &phy_axg_pcie_ops); 140 - if (IS_ERR(priv->phy)) 141 - return dev_err_probe(dev, PTR_ERR(priv->phy), 142 - "failed to create PHY\n"); 143 - 144 139 base = devm_platform_ioremap_resource(pdev, 0); 145 140 if (IS_ERR(base)) 146 141 return PTR_ERR(base); ··· 152 157 priv->analog = devm_phy_get(dev, "analog"); 153 158 if (IS_ERR(priv->analog)) 154 159 return PTR_ERR(priv->analog); 160 + 161 + priv->phy = devm_phy_create(dev, np, &phy_axg_pcie_ops); 162 + if (IS_ERR(priv->phy)) 163 + return dev_err_probe(dev, PTR_ERR(priv->phy), 164 + "failed to create PHY\n"); 155 165 156 166 phy_set_drvdata(priv->phy, priv); 157 167 dev_set_drvdata(dev, priv);