diff options
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index df3306019a7e..d81f3cc43ff1 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -377,6 +377,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) | |||
377 | pool->slab_flags |= SLAB_CACHE_DMA; | 377 | pool->slab_flags |= SLAB_CACHE_DMA; |
378 | pool->gfp_mask = __GFP_DMA; | 378 | pool->gfp_mask = __GFP_DMA; |
379 | } | 379 | } |
380 | |||
381 | if (hostt->cmd_size) | ||
382 | hostt->cmd_pool = pool; | ||
383 | |||
380 | return pool; | 384 | return pool; |
381 | } | 385 | } |
382 | 386 | ||
@@ -421,8 +425,10 @@ out: | |||
421 | out_free_slab: | 425 | out_free_slab: |
422 | kmem_cache_destroy(pool->cmd_slab); | 426 | kmem_cache_destroy(pool->cmd_slab); |
423 | out_free_pool: | 427 | out_free_pool: |
424 | if (hostt->cmd_size) | 428 | if (hostt->cmd_size) { |
425 | scsi_free_host_cmd_pool(pool); | 429 | scsi_free_host_cmd_pool(pool); |
430 | hostt->cmd_pool = NULL; | ||
431 | } | ||
426 | goto out; | 432 | goto out; |
427 | } | 433 | } |
428 | 434 | ||
@@ -444,8 +450,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost) | |||
444 | if (!--pool->users) { | 450 | if (!--pool->users) { |
445 | kmem_cache_destroy(pool->cmd_slab); | 451 | kmem_cache_destroy(pool->cmd_slab); |
446 | kmem_cache_destroy(pool->sense_slab); | 452 | kmem_cache_destroy(pool->sense_slab); |
447 | if (hostt->cmd_size) | 453 | if (hostt->cmd_size) { |
448 | scsi_free_host_cmd_pool(pool); | 454 | scsi_free_host_cmd_pool(pool); |
455 | hostt->cmd_pool = NULL; | ||
456 | } | ||
449 | } | 457 | } |
450 | mutex_unlock(&host_cmd_pool_mutex); | 458 | mutex_unlock(&host_cmd_pool_mutex); |
451 | } | 459 | } |