cxgb4: remove workqueue when driver registration fails

Submitted by Wei Yang on Sept. 6, 2013, 1:32 a.m.

Details

Message ID 1378431145-7203-1-git-send-email-weiyang@linux.vnet.ibm.com
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message

Wei Yang Sept. 6, 2013, 1:32 a.m.
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.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Sept. 11, 2013, 7:52 p.m.
From: Wei Yang <weiyang@linux.vnet.ibm.com>
Date: Fri,  6 Sep 2013 09:32:25 +0800

> 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.
> 
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>

This patch was corrupted by your email client, please email the patch
to yourself, make sure the patch you receive in the email applies
cleanly to the current 'net' tree, and then resubmit.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wei Yang Sept. 15, 2013, 12:24 p.m.
On Wed, Sep 11, 2013 at 03:52:00PM -0400, David Miller wrote:
>From: Wei Yang <weiyang@linux.vnet.ibm.com>
>Date: Fri,  6 Sep 2013 09:32:25 +0800
>
>> 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.
>> 
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>
>This patch was corrupted by your email client, please email the patch
>to yourself, make sure the patch you receive in the email applies
>cleanly to the current 'net' tree, and then resubmit.

Sorry for this bothering. 

I will re-do it.

Thanks.

>
>Thanks.

Patch hide | download patch | download mbox

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 5a3256b..1dde5a3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -5868,8 +5868,11 @@  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);
+	}
 	return ret;
 }
 
-- 
1.7.1