From f13ece3ce03f6e04644e6e9bc4fc45136bc8fe0e Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 25 Jan 2008 23:25:14 +0900 Subject: [PATCH] --- yaml --- r: 80597 b: refs/heads/master c: 3d9dd6eef888658d26ebea0cc24d15d2a93ab015 h: refs/heads/master i: 80595: cb90ea552b64277968b91e4147033259c1ae5c9b v: v3 --- [refs] | 2 +- trunk/drivers/scsi/scsi_lib.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 772a05d925ab..c5ef7c424e8c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b172b6e99e948b6abb180082cfeb8f9b1450ebff +refs/heads/master: 3d9dd6eef888658d26ebea0cc24d15d2a93ab015 diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index 7bfec7e7a8a0..b12fb310e399 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -1682,7 +1682,7 @@ int __init scsi_init_queue(void) 0, 0, NULL); if (!scsi_bidi_sdb_cache) { printk(KERN_ERR "SCSI: can't init scsi bidi sdb cache\n"); - return -ENOMEM; + goto cleanup_io_context; } for (i = 0; i < SG_MEMPOOL_NR; i++) { @@ -1694,6 +1694,7 @@ int __init scsi_init_queue(void) if (!sgp->slab) { printk(KERN_ERR "SCSI: can't init sg slab %s\n", sgp->name); + goto cleanup_bidi_sdb; } sgp->pool = mempool_create_slab_pool(SG_MEMPOOL_SIZE, @@ -1701,10 +1702,25 @@ int __init scsi_init_queue(void) if (!sgp->pool) { printk(KERN_ERR "SCSI: can't init sg mempool %s\n", sgp->name); + goto cleanup_bidi_sdb; } } return 0; + +cleanup_bidi_sdb: + for (i = 0; i < SG_MEMPOOL_NR; i++) { + struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; + if (sgp->pool) + mempool_destroy(sgp->pool); + if (sgp->slab) + kmem_cache_destroy(sgp->slab); + } + kmem_cache_destroy(scsi_bidi_sdb_cache); +cleanup_io_context: + kmem_cache_destroy(scsi_io_context_cache); + + return -ENOMEM; } void scsi_exit_queue(void)