Commit 26146b0e authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: cleanup probed ports in the probe error path

This patches fixes the probe error path by cleaning up probed ports, to
avoid leaving registered net devices when the driver failed to probe.

Fixes: 3f518509 ("ethernet: Add new driver for Marvell Armada 375 network unit")
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ba2d8d88
...@@ -8329,7 +8329,7 @@ static int mvpp2_probe(struct platform_device *pdev) ...@@ -8329,7 +8329,7 @@ static int mvpp2_probe(struct platform_device *pdev)
for_each_available_child_of_node(dn, port_node) { for_each_available_child_of_node(dn, port_node) {
err = mvpp2_port_probe(pdev, port_node, priv, i); err = mvpp2_port_probe(pdev, port_node, priv, i);
if (err < 0) if (err < 0)
goto err_mg_clk; goto err_port_probe;
i++; i++;
} }
...@@ -8345,12 +8345,19 @@ static int mvpp2_probe(struct platform_device *pdev) ...@@ -8345,12 +8345,19 @@ static int mvpp2_probe(struct platform_device *pdev)
priv->stats_queue = create_singlethread_workqueue(priv->queue_name); priv->stats_queue = create_singlethread_workqueue(priv->queue_name);
if (!priv->stats_queue) { if (!priv->stats_queue) {
err = -ENOMEM; err = -ENOMEM;
goto err_mg_clk; goto err_port_probe;
} }
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
return 0; return 0;
err_port_probe:
i = 0;
for_each_available_child_of_node(dn, port_node) {
if (priv->port_list[i])
mvpp2_port_remove(priv->port_list[i]);
i++;
}
err_mg_clk: err_mg_clk:
clk_disable_unprepare(priv->axi_clk); clk_disable_unprepare(priv->axi_clk);
if (priv->hw_version == MVPP22) if (priv->hw_version == MVPP22)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment