Messages in this thread Patch in this message | | | From | Wen Yang <> | Subject | [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed | Date | Wed, 28 Nov 2018 16:05:53 +0800 |
| |
dma_pool_destroy(NULL) is safe, so removes NULL check before freeing the mem. This patch also fix the ifnullfree.cocci warnings.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> CC: Julia Lawall <julia.lawall@lip6.fr> CC: Kashyap Desai <kashyap.desai@broadcom.com> CC: Sumit Saxena <sumit.saxena@broadcom.com> CC: Shivasharan S <shivasharan.srikanteshwara@broadcom.com> CC: linux-kernel@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index f74b5ea24f0f..aa477f09a7a5 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) { } - if (fusion->reply_frames_desc_pool) - dma_pool_destroy(fusion->reply_frames_desc_pool); - if (fusion->reply_frames_desc_pool_align) - dma_pool_destroy(fusion->reply_frames_desc_pool_align); + dma_pool_destroy(fusion->reply_frames_desc_pool); + dma_pool_destroy(fusion->reply_frames_desc_pool_align); if (fusion->rdpq_virt) dma_free_coherent(&instance->pdev->dev, @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas_instance *instance) { fusion->reply_frames_desc[0], fusion->reply_frames_desc_phys[0]); - if (fusion->reply_frames_desc_pool) - dma_pool_destroy(fusion->reply_frames_desc_pool); + dma_pool_destroy(fusion->reply_frames_desc_pool); } @@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init_cmd(struct megasas_instance *instance) fusion->ioc_init_cmd->frame, fusion->ioc_init_cmd->frame_phys_addr); - if (fusion->ioc_init_cmd) - kfree(fusion->ioc_init_cmd); + kfree(fusion->ioc_init_cmd); } /** -- 2.19.1
| |