diff options
| author | Thomas Meyer <thomas@m3y3r.de> | 2018-12-02 15:52:11 -0500 |
|---|---|---|
| committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-12-07 21:46:22 -0500 |
| commit | 19c0507252c977ba8b3d2e2fe99afd2c176a993b (patch) | |
| tree | c3c3a2dd8df1611d05beef8485f2165abcdcf06c | |
| parent | c4e521b654e15e372a6429e269e7e907b4698224 (diff) | |
scsi: megaraid_sas: NULL check before some freeing functions is not needed
NULL check before some freeing functions is not needed.
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| -rw-r--r-- | drivers/scsi/megaraid/megaraid_mbox.c | 9 | ||||
| -rw-r--r-- | drivers/scsi/megaraid/megaraid_mm.c | 3 | ||||
| -rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 |
3 files changed, 8 insertions, 16 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 3b7abe5ca7f5..7f9ba88d1c2d 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
| @@ -1243,8 +1243,7 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter) | |||
| 1243 | dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr, | 1243 | dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr, |
| 1244 | sg_pci_blk[i].dma_addr); | 1244 | sg_pci_blk[i].dma_addr); |
| 1245 | } | 1245 | } |
| 1246 | if (raid_dev->sg_pool_handle) | 1246 | dma_pool_destroy(raid_dev->sg_pool_handle); |
| 1247 | dma_pool_destroy(raid_dev->sg_pool_handle); | ||
| 1248 | 1247 | ||
| 1249 | 1248 | ||
| 1250 | epthru_pci_blk = raid_dev->epthru_pool; | 1249 | epthru_pci_blk = raid_dev->epthru_pool; |
| @@ -1252,8 +1251,7 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter) | |||
| 1252 | dma_pool_free(raid_dev->epthru_pool_handle, | 1251 | dma_pool_free(raid_dev->epthru_pool_handle, |
| 1253 | epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr); | 1252 | epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr); |
| 1254 | } | 1253 | } |
| 1255 | if (raid_dev->epthru_pool_handle) | 1254 | dma_pool_destroy(raid_dev->epthru_pool_handle); |
| 1256 | dma_pool_destroy(raid_dev->epthru_pool_handle); | ||
| 1257 | 1255 | ||
| 1258 | 1256 | ||
| 1259 | mbox_pci_blk = raid_dev->mbox_pool; | 1257 | mbox_pci_blk = raid_dev->mbox_pool; |
| @@ -1261,8 +1259,7 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter) | |||
| 1261 | dma_pool_free(raid_dev->mbox_pool_handle, | 1259 | dma_pool_free(raid_dev->mbox_pool_handle, |
| 1262 | mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr); | 1260 | mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr); |
| 1263 | } | 1261 | } |
| 1264 | if (raid_dev->mbox_pool_handle) | 1262 | dma_pool_destroy(raid_dev->mbox_pool_handle); |
| 1265 | dma_pool_destroy(raid_dev->mbox_pool_handle); | ||
| 1266 | 1263 | ||
| 1267 | return; | 1264 | return; |
| 1268 | } | 1265 | } |
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 8428247015db..3ce837e4b24c 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
| @@ -1017,8 +1017,7 @@ memalloc_error: | |||
| 1017 | kfree(adapter->kioc_list); | 1017 | kfree(adapter->kioc_list); |
| 1018 | kfree(adapter->mbox_list); | 1018 | kfree(adapter->mbox_list); |
| 1019 | 1019 | ||
| 1020 | if (adapter->pthru_dma_pool) | 1020 | dma_pool_destroy(adapter->pthru_dma_pool); |
| 1021 | dma_pool_destroy(adapter->pthru_dma_pool); | ||
| 1022 | 1021 | ||
| 1023 | kfree(adapter); | 1022 | kfree(adapter); |
| 1024 | 1023 | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 8f37ad83be9a..f2cbdcaef606 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c | |||
| @@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) { | |||
| 807 | 807 | ||
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | if (fusion->reply_frames_desc_pool) | 810 | dma_pool_destroy(fusion->reply_frames_desc_pool); |
| 811 | dma_pool_destroy(fusion->reply_frames_desc_pool); | 811 | dma_pool_destroy(fusion->reply_frames_desc_pool_align); |
| 812 | if (fusion->reply_frames_desc_pool_align) | ||
| 813 | dma_pool_destroy(fusion->reply_frames_desc_pool_align); | ||
| 814 | 812 | ||
| 815 | if (fusion->rdpq_virt) | 813 | if (fusion->rdpq_virt) |
| 816 | dma_free_coherent(&instance->pdev->dev, | 814 | dma_free_coherent(&instance->pdev->dev, |
| @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas_instance *instance) { | |||
| 830 | fusion->reply_frames_desc[0], | 828 | fusion->reply_frames_desc[0], |
| 831 | fusion->reply_frames_desc_phys[0]); | 829 | fusion->reply_frames_desc_phys[0]); |
| 832 | 830 | ||
| 833 | if (fusion->reply_frames_desc_pool) | 831 | dma_pool_destroy(fusion->reply_frames_desc_pool); |
| 834 | dma_pool_destroy(fusion->reply_frames_desc_pool); | ||
| 835 | 832 | ||
| 836 | } | 833 | } |
| 837 | 834 | ||
| @@ -1623,8 +1620,7 @@ static inline void megasas_free_ioc_init_cmd(struct megasas_instance *instance) | |||
| 1623 | fusion->ioc_init_cmd->frame, | 1620 | fusion->ioc_init_cmd->frame, |
| 1624 | fusion->ioc_init_cmd->frame_phys_addr); | 1621 | fusion->ioc_init_cmd->frame_phys_addr); |
| 1625 | 1622 | ||
| 1626 | if (fusion->ioc_init_cmd) | 1623 | kfree(fusion->ioc_init_cmd); |
| 1627 | kfree(fusion->ioc_init_cmd); | ||
| 1628 | } | 1624 | } |
| 1629 | 1625 | ||
| 1630 | /** | 1626 | /** |
