netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx4_core: destroy workqueue when driver fails to register
@ 2013-12-02  1:44 Wei Yang
  2013-12-02  8:12 ` Amir Vadai
  2013-12-02 20:11 ` Or Gerlitz
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Yang @ 2013-12-02  1:44 UTC (permalink / raw)
  To: davem, amirv, jackm, netdev; +Cc: Wei Yang

When driver registration fails, we need to clean up the resources allocated
before. mlx4_core missed to destroy the workqueue allocated.

This patch destroies the workqueue when registration fails.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5789ea2..01fc651 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2635,6 +2635,8 @@ static int __init mlx4_init(void)
 		return -ENOMEM;
 
 	ret = pci_register_driver(&mlx4_driver);
+	if (ret < 0)
+		destroy_workqueue(mlx4_wq);
 	return ret < 0 ? ret : 0;
 }
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] net/mlx4_core: destroy workqueue when driver fails to register
@ 2013-12-03  2:04 Wei Yang
  2013-12-03 16:56 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Yang @ 2013-12-03  2:04 UTC (permalink / raw)
  To: davem, amirv, jackm; +Cc: netdev, Wei Yang

When driver registration fails, we need to clean up the resources allocated
before. mlx4_core missed destroying the workqueue allocated.

This patch destroys the workqueue when registration fails.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5789ea2..01fc651 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2635,6 +2635,8 @@ static int __init mlx4_init(void)
 		return -ENOMEM;
 
 	ret = pci_register_driver(&mlx4_driver);
+	if (ret < 0)
+		destroy_workqueue(mlx4_wq);
 	return ret < 0 ? ret : 0;
 }
 
-- 
1.7.5.4

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

end of thread, other threads:[~2013-12-03 16:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02  1:44 [PATCH] net/mlx4_core: destroy workqueue when driver fails to register Wei Yang
2013-12-02  8:12 ` Amir Vadai
2013-12-02 20:11 ` Or Gerlitz
2013-12-03  1:36   ` Wei Yang
  -- strict thread matches above, loose matches on Subject: below --
2013-12-03  2:04 Wei Yang
2013-12-03 16:56 ` 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).