diff options
author | Elias Oltmanns <eo@nebensachen.de> | 2008-07-30 15:32:39 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-31 01:47:12 -0400 |
commit | 49ea3b04971ece6a5efe5d7b763ad9d2f169d441 (patch) | |
tree | 6dedd75ec55edd1ce2c30bb3a9b81e2e8efcb6e8 /drivers | |
parent | 2486fa561a3192bbbec39c7feef87a1e07bd6342 (diff) |
libata-core: make sure that ata_force_tbl is freed in case of an error
Fix a potential memory leak when ata_init() encounters an error.
Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-core.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 9cd04f684102..f69d1548b562 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -6098,16 +6098,20 @@ static int __init ata_init(void) | |||
6098 | 6098 | ||
6099 | ata_wq = create_workqueue("ata"); | 6099 | ata_wq = create_workqueue("ata"); |
6100 | if (!ata_wq) | 6100 | if (!ata_wq) |
6101 | return -ENOMEM; | 6101 | goto free_force_tbl; |
6102 | 6102 | ||
6103 | ata_aux_wq = create_singlethread_workqueue("ata_aux"); | 6103 | ata_aux_wq = create_singlethread_workqueue("ata_aux"); |
6104 | if (!ata_aux_wq) { | 6104 | if (!ata_aux_wq) |
6105 | destroy_workqueue(ata_wq); | 6105 | goto free_wq; |
6106 | return -ENOMEM; | ||
6107 | } | ||
6108 | 6106 | ||
6109 | printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n"); | 6107 | printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n"); |
6110 | return 0; | 6108 | return 0; |
6109 | |||
6110 | free_wq: | ||
6111 | destroy_workqueue(ata_wq); | ||
6112 | free_force_tbl: | ||
6113 | kfree(ata_force_tbl); | ||
6114 | return -ENOMEM; | ||
6111 | } | 6115 | } |
6112 | 6116 | ||
6113 | static void __exit ata_exit(void) | 6117 | static void __exit ata_exit(void) |