aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-miphy365x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/phy/phy-miphy365x.c')
-rw-r--r--drivers/phy/phy-miphy365x.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c
index 00a686a073ed..e661f3b36eaa 100644
--- a/drivers/phy/phy-miphy365x.c
+++ b/drivers/phy/phy-miphy365x.c
@@ -566,22 +566,25 @@ static int miphy365x_probe(struct platform_device *pdev)
566 566
567 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), 567 miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy),
568 GFP_KERNEL); 568 GFP_KERNEL);
569 if (!miphy_phy) 569 if (!miphy_phy) {
570 return -ENOMEM; 570 ret = -ENOMEM;
571 goto put_child;
572 }
571 573
572 miphy_dev->phys[port] = miphy_phy; 574 miphy_dev->phys[port] = miphy_phy;
573 575
574 phy = devm_phy_create(&pdev->dev, child, &miphy365x_ops); 576 phy = devm_phy_create(&pdev->dev, child, &miphy365x_ops);
575 if (IS_ERR(phy)) { 577 if (IS_ERR(phy)) {
576 dev_err(&pdev->dev, "failed to create PHY\n"); 578 dev_err(&pdev->dev, "failed to create PHY\n");
577 return PTR_ERR(phy); 579 ret = PTR_ERR(phy);
580 goto put_child;
578 } 581 }
579 582
580 miphy_dev->phys[port]->phy = phy; 583 miphy_dev->phys[port]->phy = phy;
581 584
582 ret = miphy365x_of_probe(child, miphy_phy); 585 ret = miphy365x_of_probe(child, miphy_phy);
583 if (ret) 586 if (ret)
584 return ret; 587 goto put_child;
585 588
586 phy_set_drvdata(phy, miphy_dev->phys[port]); 589 phy_set_drvdata(phy, miphy_dev->phys[port]);
587 590
@@ -591,12 +594,15 @@ static int miphy365x_probe(struct platform_device *pdev)
591 &miphy_phy->ctrlreg); 594 &miphy_phy->ctrlreg);
592 if (ret) { 595 if (ret) {
593 dev_err(&pdev->dev, "No sysconfig offset found\n"); 596 dev_err(&pdev->dev, "No sysconfig offset found\n");
594 return ret; 597 goto put_child;
595 } 598 }
596 } 599 }
597 600
598 provider = devm_of_phy_provider_register(&pdev->dev, miphy365x_xlate); 601 provider = devm_of_phy_provider_register(&pdev->dev, miphy365x_xlate);
599 return PTR_ERR_OR_ZERO(provider); 602 return PTR_ERR_OR_ZERO(provider);
603put_child:
604 of_node_put(child);
605 return ret;
600} 606}
601 607
602static const struct of_device_id miphy365x_of_match[] = { 608static const struct of_device_id miphy365x_of_match[] = {