linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs
@ 2019-05-27 11:17 Jisheng Zhang
  2019-05-28 18:07 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2019-05-27 11:17 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller
  Cc: netdev, linux-arm-kernel, linux-kernel

Make use of devm_alloc_etherdev_mqs() to simplify the code.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a87ec70b19f1..08022fbcb67a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4243,9 +4243,9 @@ int stmmac_dvr_probe(struct device *device,
 	u32 queue, maxq;
 	int ret = 0;
 
-	ndev = alloc_etherdev_mqs(sizeof(struct stmmac_priv),
-				  MTL_MAX_TX_QUEUES,
-				  MTL_MAX_RX_QUEUES);
+	ndev = devm_alloc_etherdev_mqs(sizeof(struct stmmac_priv),
+				       MTL_MAX_TX_QUEUES,
+				       MTL_MAX_RX_QUEUES);
 	if (!ndev)
 		return -ENOMEM;
 
@@ -4277,8 +4277,7 @@ int stmmac_dvr_probe(struct device *device,
 	priv->wq = create_singlethread_workqueue("stmmac_wq");
 	if (!priv->wq) {
 		dev_err(priv->device, "failed to create workqueue\n");
-		ret = -ENOMEM;
-		goto error_wq;
+		return -ENOMEM;
 	}
 
 	INIT_WORK(&priv->service_task, stmmac_service_task);
@@ -4434,8 +4433,6 @@ int stmmac_dvr_probe(struct device *device,
 	}
 error_hw_init:
 	destroy_workqueue(priv->wq);
-error_wq:
-	free_netdev(ndev);
 
 	return ret;
 }
@@ -4472,7 +4469,6 @@ int stmmac_dvr_remove(struct device *dev)
 		stmmac_mdio_unregister(ndev);
 	destroy_workqueue(priv->wq);
 	mutex_destroy(&priv->lock);
-	free_netdev(ndev);
 
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs
  2019-05-27 11:17 [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs Jisheng Zhang
@ 2019-05-28 18:07 ` David Miller
  2019-05-29  2:28   ` Jisheng Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-05-28 18:07 UTC (permalink / raw)
  To: Jisheng.Zhang
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, netdev,
	linux-arm-kernel, linux-kernel


You never even tried to compiled this patch.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs
  2019-05-28 18:07 ` David Miller
@ 2019-05-29  2:28   ` Jisheng Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Jisheng Zhang @ 2019-05-29  2:28 UTC (permalink / raw)
  To: David Miller
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, netdev,
	linux-arm-kernel, linux-kernel

On Tue, 28 May 2019 11:07:53 -0700 David Miller wrote:

> 
> You never even tried to compiled this patch.
> 

oops, my bad. I patched the another branch and tested the patch but when I
manually patch net-next tree, I made a mistake. Sorry.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-29  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 11:17 [PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs Jisheng Zhang
2019-05-28 18:07 ` David Miller
2019-05-29  2:28   ` Jisheng Zhang

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).