net: mvneta: Switch to using devm_alloc_etherdev_mqs
Subsystems (3)
PATCH 1/1 net: mvneta: Switch to using devm_alloc_etherdev_mqs
It allows some of the code to be simplified.
Signed-off-by Rosen Penev <[email protected]>
--- drivers/net/ethernet/marvell/mvneta.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +4 -9
@@ -4422,15 +4422,14 @@ static int mvneta_probe(struct platform_device *pdev)int err;int cpu; - dev =alloc_etherdev_mqs (sizeof (struct mvneta_port ), txq_number, rxq_number); + dev =devm_alloc_etherdev_mqs (&pdev->dev,sizeof (struct mvneta_port ), + txq_number, rxq_number);if (!dev)return -ENOMEM ; dev->irq =irq_of_parse_and_map (dn,0 ); -if (dev->irq ==0 ) { - err = -EINVAL ; - goto err_free_netdev; - } +if (dev->irq ==0 ) +return -EINVAL ; phy_mode =of_get_phy_mode (dn);if (phy_mode <0 ) {
@@ -4641,9 +4640,6 @@ static int mvneta_probe(struct platform_device *pdev)phylink_destroy (pp->phylink); err_free_irq:irq_dispose_mapping (dev->irq); -err_free_netdev: -free_netdev (dev); -return err; }/* Device removal routine */
@@ -4659,7 +4655,6 @@ static int mvneta_remove(struct platform_device *pdev)free_percpu (pp->stats);irq_dispose_mapping (dev->irq);phylink_destroy (pp->phylink); -free_netdev (dev);if (pp->bm_priv) {mvneta_bm_pool_destroy (pp->bm_priv, pp->pool_long,1 << pp->id);
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Rosen Penev <[email protected]>
Date: Tue, 19 Mar 2019 13:53:40 -0700
Quoted 1 line
It allows some of the code to be simplified.
...
drivers/net/ethernet/marvell/mvneta.c static int mvneta_probe(struct platform_device *pdev) · line 4646
Quoted 7 lines
drivers/net/ethernet/marvell/mvneta.c +0
-3@@ -4641,9 +4640,6 @@ static int mvneta_probe(struct platform_device *pdev)phylink_destroy (pp->phylink); err_free_irq:irq_dispose_mapping (dev->irq); -err_free_netdev: -free_netdev (dev); -return err;
It would be great if the code was compile tested too.
You're removing the error return the err_free_irq: path needs.