* [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs
@ 2019-03-09 5:15 Rosen Penev
2019-03-09 7:24 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2019-03-09 5:15 UTC (permalink / raw)
To: netdev
It allows some of the code to be simplified.
Tested on Turris Omnia.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/marvell/mvneta.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index ff275780040f..e73c3af4ea9b 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4457,15 +4457,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) {
@@ -4686,9 +4685,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 */
@@ -4704,7 +4700,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);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs
2019-03-09 5:15 Rosen Penev
@ 2019-03-09 7:24 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-09 7:24 UTC (permalink / raw)
To: rosenp; +Cc: netdev
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 8 Mar 2019 21:15:29 -0800
> It allows some of the code to be simplified.
>
> Tested on Turris Omnia.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
This and your other patch are both net-next material.
net-next is closed, please resubmit these when it reopens.
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs
@ 2019-03-19 20:53 Rosen Penev
2019-03-19 22:05 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2019-03-19 20:53 UTC (permalink / raw)
To: netdev
It allows some of the code to be simplified.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/marvell/mvneta.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index a78a39244b79..8376ee12ef10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs
2019-03-19 20:53 [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs Rosen Penev
@ 2019-03-19 22:05 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-19 22:05 UTC (permalink / raw)
To: rosenp; +Cc: netdev
From: Rosen Penev <rosenp@gmail.com>
Date: Tue, 19 Mar 2019 13:53:40 -0700
> It allows some of the code to be simplified.
...
> @@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-19 22:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19 20:53 [PATCH] net: mvneta: Switch to using devm_alloc_etherdev_mqs Rosen Penev
2019-03-19 22:05 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2019-03-09 5:15 Rosen Penev
2019-03-09 7:24 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).