aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorElias Oltmanns <eo@nebensachen.de>2008-07-30 15:32:39 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-31 01:47:12 -0400
commit49ea3b04971ece6a5efe5d7b763ad9d2f169d441 (patch)
tree6dedd75ec55edd1ce2c30bb3a9b81e2e8efcb6e8 /drivers/ata
parent2486fa561a3192bbbec39c7feef87a1e07bd6342 (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/ata')
-rw-r--r--drivers/ata/libata-core.c14
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
6110free_wq:
6111 destroy_workqueue(ata_wq);
6112free_force_tbl:
6113 kfree(ata_force_tbl);
6114 return -ENOMEM;
6111} 6115}
6112 6116
6113static void __exit ata_exit(void) 6117static void __exit ata_exit(void)