Commit 67a3fa2f authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Greg Kroah-Hartman

net: mvneta: Fix err code path of probe

[ Upstream commit d484e06e ]

Fix below issues in err code path of probe:
1. we don't need to unregister_netdev() because the netdev isn't
registered.
2. when register_netdev() fails, we also need to destroy bm pool for
HWBM case.

Fixes: dc35a10f ("net: mvneta: bm: add support for hardware buffer management")
Signed-off-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d46ed35e
...@@ -4674,7 +4674,7 @@ static int mvneta_probe(struct platform_device *pdev) ...@@ -4674,7 +4674,7 @@ static int mvneta_probe(struct platform_device *pdev)
err = register_netdev(dev); err = register_netdev(dev);
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "failed to register\n"); dev_err(&pdev->dev, "failed to register\n");
goto err_free_stats; goto err_netdev;
} }
netdev_info(dev, "Using %s mac address %pM\n", mac_from, netdev_info(dev, "Using %s mac address %pM\n", mac_from,
...@@ -4685,14 +4685,12 @@ static int mvneta_probe(struct platform_device *pdev) ...@@ -4685,14 +4685,12 @@ static int mvneta_probe(struct platform_device *pdev)
return 0; return 0;
err_netdev: err_netdev:
unregister_netdev(dev);
if (pp->bm_priv) { if (pp->bm_priv) {
mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id); mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
1 << pp->id); 1 << pp->id);
mvneta_bm_put(pp->bm_priv); mvneta_bm_put(pp->bm_priv);
} }
err_free_stats:
free_percpu(pp->stats); free_percpu(pp->stats);
err_free_ports: err_free_ports:
free_percpu(pp->ports); free_percpu(pp->ports);
......
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