From: SF Markus Elfring <elfring@users.sourceforge.net>
To: "James E. J. Bottomley" <JBottomley@parallels.com>,
QLogic-Storage-Upstream@qlogic.com, linux-scsi@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 1/4] SCSI-QLA4...: Deletion of unnecessary checks before three function calls
Date: Fri, 06 Feb 2015 23:13:06 +0100 [thread overview]
Message-ID: <54D53C72.1020702@users.sourceforge.net> (raw)
In-Reply-To: <54D53BE4.7010807@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
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
next prev parent reply other threads:[~2015-02-06 22:13 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-10-22 18:55 ` [PATCH 1/1] SCSI-QLA2XXX: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
2014-10-22 19:10 ` [PATCH 1/1] SCSI-QLA2...: " SF Markus Elfring
2014-11-20 17:23 ` [PATCH 1/1] SCSI-OSD: Deletion of an unnecessary check before the function call "put_disk" SF Markus Elfring
2015-06-24 14:16 ` [PATCH] SCSI-OSD: Delete " SF Markus Elfring
2015-06-24 14:32 ` Johannes Thumshirn
2015-06-28 9:39 ` Boaz Harrosh
2014-11-20 17:55 ` [PATCH 1/1] SCSI: Deletion of unnecessary checks before the function call "put_device" SF Markus Elfring
2015-06-24 17:28 ` [PATCH] SCSI: Delete " SF Markus Elfring
2014-11-20 19:15 ` [PATCH 1/1] SCSI-libfc: Deletion of an unnecessary check before the function call "fc_fcp_ddp_done" SF Markus Elfring
2015-06-24 15:54 ` [PATCH] SCSI-libfc: Delete " SF Markus Elfring
[not found] ` <558AD2D0.6000501-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2015-06-25 17:44 ` Vasu Dev
2014-11-20 19:42 ` [PATCH 1/1] SCSI-eata_pio: Deletion of an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
2015-06-30 12:52 ` [PATCH] " SF Markus Elfring
2014-11-20 22:23 ` [PATCH 1/1] SCSI-aic94xx: Deletion of an unnecessary check before the function call "kfree" SF Markus Elfring
2015-06-30 12:50 ` [PATCH] " SF Markus Elfring
2014-11-20 22:46 ` [PATCH 1/1] SCSI-bfa: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-11-21 4:20 ` Anil Gurumurthy
2015-06-30 12:38 ` [PATCH] " SF Markus Elfring
2014-11-21 8:20 ` [PATCH 1/1] SCSI-libcxgbi: Deletion of an unnecessary check before the function call "dst_release" SF Markus Elfring
2015-07-09 8:34 ` [PATCH] " SF Markus Elfring
2014-11-21 8:45 ` [PATCH 1/1] SCSI-fnic: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2015-06-24 18:45 ` [PATCH] SCSI-fnic: Delete " SF Markus Elfring
2014-11-21 9:30 ` [PATCH 1/1] target: Deletion of unnecessary checks before the function call "module_put" SF Markus Elfring
2014-11-21 21:57 ` Nicholas A. Bellinger
2015-01-18 14:31 ` [PATCH 0/3] block: Deletion of checks before three function calls SF Markus Elfring
2015-01-18 14:37 ` [PATCH 1/3] block-cciss: Deletion of an unnecessary check before the function call "put_disk" SF Markus Elfring
2015-01-18 14:43 ` [PATCH 3/3] block: Deletion of checks before the function call "iounmap" SF Markus Elfring
2015-02-05 21:07 ` [PATCH] SCSI-bfa: Delete more unnecessary checks before the function call "vfree" SF Markus Elfring
2015-02-05 21:27 ` [PATCH] SCSI-aic7...: Delete unnecessary checks before the function call "kfree" SF Markus Elfring
2015-07-09 8:22 ` SF Markus Elfring
2015-02-05 22:25 ` [PATCH 0/2] SCSI-lpfc: Deletion of an unnecessary check SF Markus Elfring
2015-02-05 22:26 ` [PATCH 1/2] SCSI-lpfc: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-02-05 22:28 ` [PATCH 2/2] SCSI-lpfc: One function call less in lpfc_bsg_hba_set_event() after error detection SF Markus Elfring
2015-02-16 15:58 ` [PATCH 0/2] SCSI-lpfc: Deletion of an unnecessary check James Smart
2015-02-06 17:20 ` [PATCH 0/3] SCSI-debug: Deletion of a few unnecessary checks SF Markus Elfring
2015-02-06 17:23 ` [PATCH 1/3] SCSI-debug: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
2015-02-23 18:14 ` Douglas Gilbert
2015-02-06 17:25 ` [PATCH 2/3] SCSI-debug: Less function calls in scsi_debug_init() after error detection SF Markus Elfring
2015-02-23 18:14 ` Douglas Gilbert
2015-02-06 17:26 ` [PATCH 3/3] SCSI-debug: Fix exception handling for an alignment/granularity mismatch in scsi_debug_init() SF Markus Elfring
2015-02-23 18:15 ` Douglas Gilbert
2015-02-06 18:29 ` [PATCH] SCSI-csiostor: Delete an unnecessary check before the function call "release_firmware" SF Markus Elfring
2015-02-06 22:10 ` [PATCH 0/4] SCSI-QLA4...: Deletion of some unnecessary checks SF Markus Elfring
2015-02-06 22:13 ` SF Markus Elfring [this message]
2015-02-06 22:15 ` [PATCH 2/4] SCSI-QLA4...: Less function calls in qla4xxx_is_session_exists() after error detection SF Markus Elfring
2015-02-07 9:33 ` Dan Carpenter
2015-02-07 10:11 ` Julia Lawall
2015-02-07 10:32 ` Dan Carpenter
2015-02-07 17:23 ` SF Markus Elfring
2015-02-06 22:16 ` [PATCH 3/4] SCSI-QLA4...: Less function calls in qla4xxx_is_flash_ddb_exists() " SF Markus Elfring
2015-02-06 22:17 ` [PATCH 4/4] SCSI-QLA4...: Less function calls in qla4xxx_sysfs_ddb_logout() " SF Markus Elfring
2015-06-24 15:33 ` [PATCH] SCSI-wd33c93: Deletion of a check before the function call "wd33c93_setup" SF Markus Elfring
2015-06-25 9:55 ` Dan Carpenter
2015-11-16 8:45 ` [PATCH] SCSI-libfc: Delete an unnecessary check before the function call "kmem_cache_destroy" SF Markus Elfring
2015-11-19 18:21 ` Vasu Dev
2015-11-17 7:21 ` [PATCH] SCSI-aic94xx: Delete unnecessary checks " SF Markus Elfring
2016-07-24 11:51 ` SF Markus Elfring
2016-07-25 8:53 ` Jinpu Wang
2015-11-17 8:10 ` [PATCH] scsi_lib: Delete unnecessary checks before two function calls SF Markus Elfring
2015-11-17 8:44 ` [PATCH] SCSI-lpfc: Delete unnecessary checks before the function call "mempool_destroy" SF Markus Elfring
2015-12-16 23:17 ` James Smart
2016-07-16 20:20 ` [PATCH 0/3] xen-scsiback: Fine-tuning for scsiback_device_action() SF Markus Elfring
2016-07-16 20:22 ` [PATCH 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-18 5:01 ` Juergen Gross
2016-07-16 20:23 ` [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection SF Markus Elfring
2016-07-18 5:11 ` Juergen Gross
2016-07-19 14:56 ` SF Markus Elfring
2016-07-20 4:35 ` Juergen Gross
2016-07-20 5:10 ` SF Markus Elfring
2016-07-20 5:26 ` Juergen Gross
2016-07-20 11:27 ` [PATCH v2 0/3] xen-scsiback: Fine-tuning for scsiback_device_action() SF Markus Elfring
2016-07-20 11:30 ` [PATCH v2 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-20 11:44 ` Juergen Gross
2016-07-20 11:34 ` [PATCH v2 2/3] xen-scsiback: Rename jump labels in scsiback_device_action() SF Markus Elfring
2016-07-20 11:45 ` Juergen Gross
2016-07-20 11:36 ` [PATCH v2 3/3] xen-scsiback: Pass a failure indication as a constant SF Markus Elfring
2016-07-20 11:44 ` Juergen Gross
2016-07-16 20:24 ` [PATCH " SF Markus Elfring
2016-07-18 5:05 ` Juergen Gross
2016-07-24 12:30 ` [PATCH] scsi: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-24 12:51 ` Laurence Oberman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54D53C72.1020702@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=JBottomley@parallels.com \
--cc=QLogic-Storage-Upstream@qlogic.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).