summaryrefslogtreecommitdiff
path: root/drivers/ata
diff options
context:
space:
mode:
authorElias Oltmanns <eo@nebensachen.de>2008-07-30 12:32:39 -0700
committerJeff Garzik <jgarzik@redhat.com>2008-07-31 01:47:12 -0400
commit49ea3b04971ece6a5efe5d7b763ad9d2f169d441 (patch)
tree6dedd75ec55edd1ce2c30bb3a9b81e2e8efcb6e8 /drivers/ata
parent2486fa561a3192bbbec39c7feef87a1e07bd6342 (diff)
downloadlinux-3.10-49ea3b04971ece6a5efe5d7b763ad9d2f169d441.tar.gz
linux-3.10-49ea3b04971ece6a5efe5d7b763ad9d2f169d441.tar.bz2
linux-3.10-49ea3b04971ece6a5efe5d7b763ad9d2f169d441.zip
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 9cd04f68410..f69d1548b56 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6098,16 +6098,20 @@ static int __init ata_init(void)
ata_wq = create_workqueue("ata");
if (!ata_wq)
- return -ENOMEM;
+ goto free_force_tbl;
ata_aux_wq = create_singlethread_workqueue("ata_aux");
- if (!ata_aux_wq) {
- destroy_workqueue(ata_wq);
- return -ENOMEM;
- }
+ if (!ata_aux_wq)
+ goto free_wq;
printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
return 0;
+
+free_wq:
+ destroy_workqueue(ata_wq);
+free_force_tbl:
+ kfree(ata_force_tbl);
+ return -ENOMEM;
}
static void __exit ata_exit(void)