From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Hannes Reinecke <hare@suse.de>,
"James E. J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] scsi: Delete an unnecessary check before the function call "kfree"
Date: Sun, 24 Jul 2016 14:30:35 +0200 [thread overview]
Message-ID: <dd65c1cd-b8ee-5c44-d249-e3d9d0b08299@users.sourceforge.net> (raw)
In-Reply-To: <5317A59D.4@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Jul 2016 14:20:21 +0200
The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/scsi/scsi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f36aca..1794c0c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -864,8 +864,7 @@ retry_pg83:
rcu_assign_pointer(sdev->vpd_pg83, vpd_buf);
mutex_unlock(&sdev->inquiry_mutex);
synchronize_rcu();
- if (orig_vpd_buf)
- kfree(orig_vpd_buf);
+ kfree(orig_vpd_buf);
}
}
--
2.9.2
next prev parent reply other threads:[~2016-07-24 12:30 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 ` [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 ` SF Markus Elfring [this message]
2016-07-24 12:51 ` [PATCH] scsi: Delete an unnecessary check before the function call "kfree" 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=dd65c1cd-b8ee-5c44-d249-e3d9d0b08299@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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).