diff options
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 066292d3995a..ec3bbbde6f7a 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
| @@ -56,6 +56,9 @@ lpfc_mem_alloc(struct lpfc_hba * phba) | |||
| 56 | 56 | ||
| 57 | pool->elements = kmalloc(sizeof(struct lpfc_dmabuf) * | 57 | pool->elements = kmalloc(sizeof(struct lpfc_dmabuf) * |
| 58 | LPFC_MBUF_POOL_SIZE, GFP_KERNEL); | 58 | LPFC_MBUF_POOL_SIZE, GFP_KERNEL); |
| 59 | if (!pool->elements) | ||
| 60 | goto fail_free_lpfc_mbuf_pool; | ||
| 61 | |||
| 59 | pool->max_count = 0; | 62 | pool->max_count = 0; |
| 60 | pool->current_count = 0; | 63 | pool->current_count = 0; |
| 61 | for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) { | 64 | for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) { |
| @@ -82,10 +85,11 @@ lpfc_mem_alloc(struct lpfc_hba * phba) | |||
| 82 | fail_free_mbox_pool: | 85 | fail_free_mbox_pool: |
| 83 | mempool_destroy(phba->mbox_mem_pool); | 86 | mempool_destroy(phba->mbox_mem_pool); |
| 84 | fail_free_mbuf_pool: | 87 | fail_free_mbuf_pool: |
| 85 | while (--i) | 88 | while (i--) |
| 86 | pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, | 89 | pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, |
| 87 | pool->elements[i].phys); | 90 | pool->elements[i].phys); |
| 88 | kfree(pool->elements); | 91 | kfree(pool->elements); |
| 92 | fail_free_lpfc_mbuf_pool: | ||
| 89 | pci_pool_destroy(phba->lpfc_mbuf_pool); | 93 | pci_pool_destroy(phba->lpfc_mbuf_pool); |
| 90 | fail_free_dma_buf_pool: | 94 | fail_free_dma_buf_pool: |
| 91 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); | 95 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); |
