Skip to contentSkip to conversation

cxgb4: remove workqueue when driver registration fails

PATCH Applied Wei Yang 2 participants 4 messages Sep 15, 2013 – Sep 16, 2013

Subsystems (3)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 cxgb4: remove workqueue when driver registration fails

When driver registration fails, we need to clean up the resources allocated before. cxgb4 missed to destroy the workqueue allocated at the very beginning.

This patch destroies the workqueue when registration fails.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -1
index 0d0665c..c73cabd 100644
@@ -6149,8 +6149,10 @@ static int __init cxgb4_init_module(void)
 		pr_warn("could not create debugfs entry, continuing\n");
 
 	ret = pci_register_driver(&cxgb4_driver);
-	if (ret < 0)
+	if (ret < 0) {
 		debugfs_remove(cxgb4_debugfs_root);
+		destroy_workqueue(workq);
+	}
 
 	register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
 
Signature · 1 line
1.7.1
author
#1 lore raw

This time, I cc-ed to myself. And this applies to the latest net tree.

It looks not corrupted to me. Not sure other people can see it clearly?

Quoted 33 lines · Wei Yang

When driver registration fails, we need to clean up the resources allocated before. cxgb4 missed to destroy the workqueue allocated at the very beginning.

This patch destroies the workqueue when registration fails.

---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -1
index 0d0665c..c73cabd 100644
@@ -6149,8 +6149,10 @@ static int __init cxgb4_init_module(void)
 		pr_warn("could not create debugfs entry, continuing\n");
 
 	ret = pci_register_driver(&cxgb4_driver);
-	if (ret < 0)
+	if (ret < 0) {
 		debugfs_remove(cxgb4_debugfs_root);
+		destroy_workqueue(workq);
+	}
 
 	register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
 
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Richard Yang
Help you, Help me
author
#3 lore raw
Quoted 11 lines · David Miller

From: Wei Yang <[email protected]>
Date: Sun, 15 Sep 2013 21:53:00 +0800

Quoted 6 lines

When driver registration fails, we need to clean up the resources allocated before. cxgb4 missed to destroy the workqueue allocated at the very beginning.

This patch destroies the workqueue when registration fails.

Applied.

Thanks~

Signature · 2 lines
Richard Yang
Help you, Help me