diff options
| -rw-r--r-- | drivers/phy/phy-miphy28lp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c index 9b2848e6115d..d44493230d0c 100644 --- a/drivers/phy/phy-miphy28lp.c +++ b/drivers/phy/phy-miphy28lp.c | |||
| @@ -228,6 +228,7 @@ struct miphy28lp_dev { | |||
| 228 | struct regmap *regmap; | 228 | struct regmap *regmap; |
| 229 | struct mutex miphy_mutex; | 229 | struct mutex miphy_mutex; |
| 230 | struct miphy28lp_phy **phys; | 230 | struct miphy28lp_phy **phys; |
| 231 | int nphys; | ||
| 231 | }; | 232 | }; |
| 232 | 233 | ||
| 233 | struct miphy_initval { | 234 | struct miphy_initval { |
| @@ -1116,7 +1117,7 @@ static struct phy *miphy28lp_xlate(struct device *dev, | |||
| 1116 | return ERR_PTR(-EINVAL); | 1117 | return ERR_PTR(-EINVAL); |
| 1117 | } | 1118 | } |
| 1118 | 1119 | ||
| 1119 | for (index = 0; index < of_get_child_count(dev->of_node); index++) | 1120 | for (index = 0; index < miphy_dev->nphys; index++) |
| 1120 | if (phynode == miphy_dev->phys[index]->phy->dev.of_node) { | 1121 | if (phynode == miphy_dev->phys[index]->phy->dev.of_node) { |
| 1121 | miphy_phy = miphy_dev->phys[index]; | 1122 | miphy_phy = miphy_dev->phys[index]; |
| 1122 | break; | 1123 | break; |
| @@ -1200,15 +1201,15 @@ static int miphy28lp_probe(struct platform_device *pdev) | |||
| 1200 | struct miphy28lp_dev *miphy_dev; | 1201 | struct miphy28lp_dev *miphy_dev; |
| 1201 | struct phy_provider *provider; | 1202 | struct phy_provider *provider; |
| 1202 | struct phy *phy; | 1203 | struct phy *phy; |
| 1203 | int chancount, port = 0; | 1204 | int ret, port = 0; |
| 1204 | int ret; | ||
| 1205 | 1205 | ||
| 1206 | miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL); | 1206 | miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL); |
| 1207 | if (!miphy_dev) | 1207 | if (!miphy_dev) |
| 1208 | return -ENOMEM; | 1208 | return -ENOMEM; |
| 1209 | 1209 | ||
| 1210 | chancount = of_get_child_count(np); | 1210 | miphy_dev->nphys = of_get_child_count(np); |
| 1211 | miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount, | 1211 | miphy_dev->phys = devm_kzalloc(&pdev->dev, |
| 1212 | sizeof(phy) * miphy_dev->nphys, | ||
| 1212 | GFP_KERNEL); | 1213 | GFP_KERNEL); |
| 1213 | if (!miphy_dev->phys) | 1214 | if (!miphy_dev->phys) |
| 1214 | return -ENOMEM; | 1215 | return -ENOMEM; |
