linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: "James E. J. Bottomley" <JBottomley@parallels.com>,
	qla2xxx-upstream@qlogic.com, linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	trivial@kernel.org, Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [PATCH 1/1] SCSI-QLA2...: Deletion of unnecessary checks before the function call "vfree"
Date: Wed, 22 Oct 2014 21:10:21 +0200	[thread overview]
Message-ID: <5448011D.1000500@users.sourceforge.net> (raw)
In-Reply-To: <5317A59D.4@users.sourceforge.net>

>> If you are convinced that dropping the null tests is a good idea, then you 
>> can submit the patch that makes the change to the relevant maintainers and 
>> mailing lists.

I resent the request once more because another "Triple-X" software development
adventure might follow ...?

Regards,
Markus


>From ff44962f88ac2dae9324e30819629da4fb33f0ff Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 22 Oct 2014 20:40:31 +0200
Subject: [PATCH] SCSI-QLA2XXX: Deletion of unnecessary checks before the
 function call "vfree"

A semantic patch approach was proposed with the subject "[PATCH with
Coccinelle?] Deletion of unnecessary checks before specific function calls"
on 2014-03-05.
https://lkml.org/lkml/2014/3/5/344
http://article.gmane.org/gmane.comp.version-control.coccinelle/3513/

This patch pattern application was repeated with the help of the software
"Coccinelle 1.0.0-rc22" on the source files for Linux 3.17.1. An extract
of the automatically generated update suggestions is shown here.

It was determined that the affected source code places call functions
which perform input parameter validation already. It is therefore not
needed that a similar safety check is repeated at the call site.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/scsi/qla2xxx/qla_attr.c |  6 ++----
 drivers/scsi/qla2xxx/qla_init.c | 18 ++++++------------
 drivers/scsi/qla2xxx/qla_os.c   |  6 ++----
 3 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 82b92c4..95c4c09 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -175,10 +175,8 @@ qla2x00_sysfs_write_fw_dump_template(struct file *filp,
struct kobject *kobj,
 	uint32_t size;

 	if (off == 0) {
-		if (ha->fw_dump)
-			vfree(ha->fw_dump);
-		if (ha->fw_dump_template)
-			vfree(ha->fw_dump_template);
+		vfree(ha->fw_dump);
+		vfree(ha->fw_dump_template);

 		ha->fw_dump = NULL;
 		ha->fw_dump_len = 0;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a4dde7e..8da3d4f 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -5256,8 +5256,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t
*srisc_addr,
 	if (!IS_QLA27XX(ha))
 		return rval;

-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;

@@ -5307,8 +5306,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t
*srisc_addr,

 default_template:
 	ql_log(ql_log_warn, vha, 0x0168, "Using default fwdump template\n");
-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;

@@ -5342,8 +5340,7 @@ default_template:

 failed_template:
 	ql_log(ql_log_warn, vha, 0x016d, "Failed default fwdump template\n");
-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;
 	return rval;
@@ -5559,8 +5556,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t
*srisc_addr)
 	if (!IS_QLA27XX(ha))
 		return rval;

-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;

@@ -5609,8 +5605,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t
*srisc_addr)

 default_template:
 	ql_log(ql_log_warn, vha, 0x0178, "Using default fwdump template\n");
-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;

@@ -5644,8 +5639,7 @@ default_template:

 failed_template:
 	ql_log(ql_log_warn, vha, 0x017d, "Failed default fwdump template\n");
-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump_template);
 	ha->fw_dump_template = NULL;
 	ha->fw_dump_template_len = 0;
 	return rval;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index db3dbd9..0f9c378 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3676,10 +3676,8 @@ qla2x00_free_fw_dump(struct qla_hw_data *ha)
 		dma_free_coherent(&ha->pdev->dev,
 		    EFT_SIZE, ha->eft, ha->eft_dma);

-	if (ha->fw_dump)
-		vfree(ha->fw_dump);
-	if (ha->fw_dump_template)
-		vfree(ha->fw_dump_template);
+	vfree(ha->fw_dump);
+	vfree(ha->fw_dump_template);

 	ha->fce = NULL;
 	ha->fce_dma = 0;
-- 
2.1.2

  parent reply	other threads:[~2014-10-22 19:10 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                                 ` SF Markus Elfring [this message]
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                                   ` [PATCH 1/4] SCSI-QLA4...: Deletion of unnecessary checks before three function calls SF Markus Elfring
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=5448011D.1000500@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=JBottomley@parallels.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=qla2xxx-upstream@qlogic.com \
    --cc=trivial@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).