diff options
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r-- | drivers/ata/sata_mv.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 20a7517bd339..05c8a44adf8e 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4104,7 +4104,6 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4104 | if (!hpriv->port_phys) | 4104 | if (!hpriv->port_phys) |
4105 | return -ENOMEM; | 4105 | return -ENOMEM; |
4106 | host->private_data = hpriv; | 4106 | host->private_data = hpriv; |
4107 | hpriv->n_ports = n_ports; | ||
4108 | hpriv->board_idx = chip_soc; | 4107 | hpriv->board_idx = chip_soc; |
4109 | 4108 | ||
4110 | host->iomap = NULL; | 4109 | host->iomap = NULL; |
@@ -4126,17 +4125,24 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4126 | clk_prepare_enable(hpriv->port_clks[port]); | 4125 | clk_prepare_enable(hpriv->port_clks[port]); |
4127 | 4126 | ||
4128 | sprintf(port_number, "port%d", port); | 4127 | sprintf(port_number, "port%d", port); |
4129 | hpriv->port_phys[port] = devm_phy_get(&pdev->dev, port_number); | 4128 | hpriv->port_phys[port] = devm_phy_optional_get(&pdev->dev, |
4129 | port_number); | ||
4130 | if (IS_ERR(hpriv->port_phys[port])) { | 4130 | if (IS_ERR(hpriv->port_phys[port])) { |
4131 | rc = PTR_ERR(hpriv->port_phys[port]); | 4131 | rc = PTR_ERR(hpriv->port_phys[port]); |
4132 | hpriv->port_phys[port] = NULL; | 4132 | hpriv->port_phys[port] = NULL; |
4133 | if ((rc != -EPROBE_DEFER) && (rc != -ENODEV)) | 4133 | if (rc != -EPROBE_DEFER) |
4134 | dev_warn(&pdev->dev, "error getting phy"); | 4134 | dev_warn(&pdev->dev, "error getting phy %d", rc); |
4135 | |||
4136 | /* Cleanup only the initialized ports */ | ||
4137 | hpriv->n_ports = port; | ||
4135 | goto err; | 4138 | goto err; |
4136 | } else | 4139 | } else |
4137 | phy_power_on(hpriv->port_phys[port]); | 4140 | phy_power_on(hpriv->port_phys[port]); |
4138 | } | 4141 | } |
4139 | 4142 | ||
4143 | /* All the ports have been initialized */ | ||
4144 | hpriv->n_ports = n_ports; | ||
4145 | |||
4140 | /* | 4146 | /* |
4141 | * (Re-)program MBUS remapping windows if we are asked to. | 4147 | * (Re-)program MBUS remapping windows if we are asked to. |
4142 | */ | 4148 | */ |
@@ -4174,7 +4180,7 @@ err: | |||
4174 | clk_disable_unprepare(hpriv->clk); | 4180 | clk_disable_unprepare(hpriv->clk); |
4175 | clk_put(hpriv->clk); | 4181 | clk_put(hpriv->clk); |
4176 | } | 4182 | } |
4177 | for (port = 0; port < n_ports; port++) { | 4183 | for (port = 0; port < hpriv->n_ports; port++) { |
4178 | if (!IS_ERR(hpriv->port_clks[port])) { | 4184 | if (!IS_ERR(hpriv->port_clks[port])) { |
4179 | clk_disable_unprepare(hpriv->port_clks[port]); | 4185 | clk_disable_unprepare(hpriv->port_clks[port]); |
4180 | clk_put(hpriv->port_clks[port]); | 4186 | clk_put(hpriv->port_clks[port]); |