Skip to content

Commit

Permalink
net: mvneta: Fix err code path of probe
Browse files Browse the repository at this point in the history
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: dc35a10 ("net: mvneta: bm: add support for hardware buffer management")
Signed-off-by: Jisheng Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jisheng Zhang authored and davem330 committed May 28, 2019
1 parent 54ed6fd commit d484e06
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/ethernet/marvell/mvneta.c
Original file line number Diff line number Diff line change
Expand Up @@ -4674,7 +4674,7 @@ static int mvneta_probe(struct platform_device *pdev)
err = register_netdev(dev);
if (err < 0) {
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,
Expand All @@ -4685,14 +4685,12 @@ static int mvneta_probe(struct platform_device *pdev)
return 0;

err_netdev:
unregister_netdev(dev);
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_short,
1 << pp->id);
mvneta_bm_put(pp->bm_priv);
}
err_free_stats:
free_percpu(pp->stats);
err_free_ports:
free_percpu(pp->ports);
Expand Down

0 comments on commit d484e06

Please sign in to comment.