From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757661AbbBFWNQ (ORCPT ); Fri, 6 Feb 2015 17:13:16 -0500 Received: from mout.web.de ([212.227.17.11]:54437 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757444AbbBFWNO (ORCPT ); Fri, 6 Feb 2015 17:13:14 -0500 Message-ID: <54D53C72.1020702@users.sourceforge.net> Date: Fri, 06 Feb 2015 23:13:06 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "James E. J. Bottomley" , QLogic-Storage-Upstream@qlogic.com, linux-scsi@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/4] SCSI-QLA4...: Deletion of unnecessary checks before three function calls References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <54D53BE4.7010807@users.sourceforge.net> In-Reply-To: <54D53BE4.7010807@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:6p7Nj3yE5xtTE2+jx35r43lr/s1YxApq5iJcCuQxMSZZrTBChY0 4K4N98FBr7nlPnKd/JT6s2wrhKUyQHhahc14eXuBa1+s4OBDtpjl45mbYqh709hkKLnX5BY f96CBM14IjhmXrwijrtSTHBUxDuwJkBMnUCI9RSEAAA4k4vC6L4LyWxPz8eKQuQ6hcOwtQb jcj+j0gdXpCwVA2FBIe/Q== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Fri, 6 Feb 2015 20:38:23 +0100 The following functions perform also input parameter validation. * iscsi_boot_destroy_kset * kfree * vfree Thus the test around their calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/qla4xxx/ql4_mbx.c | 2 +- drivers/scsi/qla4xxx/ql4_os.c | 31 ++++++++++--------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index c291fdf..2343c0f 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -2410,7 +2410,7 @@ exit_free_acb: dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk), acb, acb_dma); exit_config_acb: - if ((acb_config == ACB_CONFIG_SET) && ha->saved_acb) { + if (acb_config == ACB_CONFIG_SET) { kfree(ha->saved_acb); ha->saved_acb = NULL; } diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 6d25879..2a00fd3 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -4131,9 +4131,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) dma_free_coherent(&ha->pdev->dev, ha->queues_len, ha->queues, ha->queues_dma); - if (ha->fw_dump) - vfree(ha->fw_dump); - + vfree(ha->fw_dump); ha->queues_len = 0; ha->queues = NULL; ha->queues_dma = 0; @@ -4155,8 +4153,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) if (ha->chap_dma_pool) dma_pool_destroy(ha->chap_dma_pool); - if (ha->chap_list) - vfree(ha->chap_list); + vfree(ha->chap_list); ha->chap_list = NULL; if (ha->fw_ddb_dma_pool) @@ -4175,9 +4172,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) iounmap(ha->reg); } - if (ha->reset_tmplt.buff) - vfree(ha->reset_tmplt.buff); - + vfree(ha->reset_tmplt.buff); pci_release_regions(ha->pdev); } @@ -6370,10 +6365,8 @@ static int qla4xxx_is_session_exists(struct scsi_qla_host *ha, } exit_check: - if (fw_tddb) - vfree(fw_tddb); - if (tmp_tddb) - vfree(tmp_tddb); + vfree(fw_tddb); + vfree(tmp_tddb); return ret; } @@ -6525,10 +6518,8 @@ static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha, } exit_check: - if (fw_tddb) - vfree(fw_tddb); - if (tmp_tddb) - vfree(tmp_tddb); + vfree(fw_tddb); + vfree(tmp_tddb); return ret; } @@ -7806,10 +7797,8 @@ static int qla4xxx_sysfs_ddb_logout(struct iscsi_bus_flash_session *fnode_sess, ret = -ESRCH; exit_ddb_logout: - if (flash_tddb) - vfree(flash_tddb); - if (tmp_tddb) - vfree(tmp_tddb); + vfree(flash_tddb); + vfree(tmp_tddb); if (fw_ddb_entry) dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); @@ -9002,7 +8991,7 @@ static void qla4xxx_remove_adapter(struct pci_dev *pdev) /* destroy iface from sysfs */ qla4xxx_destroy_ifaces(ha); - if ((!ql4xdisablesysfsboot) && ha->boot_kset) + if (!ql4xdisablesysfsboot) iscsi_boot_destroy_kset(ha->boot_kset); qla4xxx_destroy_fw_ddb_session(ha); -- 2.2.2