Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1223657 > unrolled thread
| Started by | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| First post | 2015-09-13 14:40 +0200 |
| Last post | 2015-09-14 14:00 +0200 |
| Articles | 14 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 00/39] drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 04/39] debugobjects: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 18/39] whci: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 05/39] xhci: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 27/39] ocfs2: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 28/39] ecryptfs: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Tyler Hicks <tyhicks@canonical.com> - 2015-09-15 04:10 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 06:40 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Tyler Hicks <tyhicks@canonical.com> - 2015-09-15 16:50 +0200
[PATCH 07/39] fs: ext4: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 30/39] block: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 13/39] staging: lustre: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 29/39] thunderbolt: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
Re: [PATCH 00/39] drop null test before destroy functions SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-14 14:00 +0200
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 00/39] drop null test before destroy functions |
| Message-ID | <q8ezT-7xJ-3@gated-at.bofh.it> |
Recent commits to kernel/git/torvalds/linux.git have made the following functions able to tolerate NULL arguments: kmem_cache_destroy (commit 3942d29918522) mempool_destroy (commit 4e3ca3e033d1) dma_pool_destroy (commit 44d7175da6ea) These patches remove the associated NULL tests for the files that I found easy to compile test. If these changes are OK, I will address the remainder later. --- arch/x86/kvm/mmu.c | 6 -- block/bio-integrity.c | 7 -- block/bio.c | 7 -- block/blk-core.c | 3 - block/elevator.c | 3 - drivers/atm/he.c | 7 -- drivers/block/aoe/aoedev.c | 3 - drivers/block/drbd/drbd_main.c | 21 ++----- drivers/block/pktcdvd.c | 3 - drivers/block/rbd.c | 6 -- drivers/dma/dmaengine.c | 6 -- drivers/firmware/google/gsmi.c | 3 - drivers/gpu/drm/i915/i915_dma.c | 19 ++---- drivers/iommu/amd_iommu_init.c | 7 -- drivers/md/bcache/bset.c | 3 - drivers/md/bcache/request.c | 3 - drivers/md/bcache/super.c | 9 +-- drivers/md/dm-bufio.c | 3 - drivers/md/dm-cache-target.c | 3 - drivers/md/dm-crypt.c | 6 -- drivers/md/dm-io.c | 3 - drivers/md/dm-log-userspace-base.c | 3 - drivers/md/dm-region-hash.c | 4 - drivers/md/dm.c | 13 +--- drivers/md/multipath.c | 3 - drivers/md/raid1.c | 6 -- drivers/md/raid10.c | 9 +-- drivers/md/raid5.c | 3 - drivers/mtd/nand/nandsim.c | 3 - drivers/mtd/ubi/attach.c | 4 - drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 3 - drivers/staging/lustre/lustre/llite/super25.c | 16 +---- drivers/staging/lustre/lustre/obdclass/genops.c | 24 ++------ drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 -- drivers/staging/rdma/hfi1/user_sdma.c | 3 - drivers/thunderbolt/ctl.c | 3 - drivers/usb/gadget/udc/bdc/bdc_core.c | 3 - drivers/usb/gadget/udc/gr_udc.c | 3 - drivers/usb/gadget/udc/mv_u3d_core.c | 3 - drivers/usb/gadget/udc/mv_udc_core.c | 3 - drivers/usb/host/fotg210-hcd.c | 12 +--- drivers/usb/host/fusbh200-hcd.c | 12 +--- drivers/usb/host/whci/init.c | 3 - drivers/usb/host/xhci-mem.c | 12 +--- fs/btrfs/backref.c | 3 - fs/btrfs/delayed-inode.c | 3 - fs/btrfs/delayed-ref.c | 12 +--- fs/btrfs/disk-io.c | 3 - fs/btrfs/extent_io.c | 6 -- fs/btrfs/extent_map.c | 3 - fs/btrfs/file.c | 3 - fs/btrfs/inode.c | 18 ++---- fs/btrfs/ordered-data.c | 3 - fs/dlm/memory.c | 6 -- fs/ecryptfs/main.c | 3 - fs/ext4/crypto.c | 9 +-- fs/ext4/extents_status.c | 3 - fs/ext4/mballoc.c | 3 - fs/f2fs/crypto.c | 9 +-- fs/gfs2/main.c | 29 ++-------- fs/jbd2/journal.c | 15 +---- fs/jbd2/revoke.c | 12 +--- fs/jbd2/transaction.c | 6 -- fs/jffs2/malloc.c | 27 +++------ fs/nfsd/nfscache.c | 6 -- fs/nilfs2/super.c | 12 +--- fs/ocfs2/dlm/dlmlock.c | 3 - fs/ocfs2/dlm/dlmmaster.c | 16 +---- fs/ocfs2/super.c | 18 ++---- fs/ocfs2/uptodate.c | 3 - lib/debugobjects.c | 3 - net/core/sock.c | 12 +--- net/dccp/ackvec.c | 12 +--- net/dccp/ccid.c | 3 - net/sunrpc/sched.c | 12 +--- 75 files changed, 180 insertions(+), 381 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 04/39] debugobjects: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-41@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@ expression x; @@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
lib/debugobjects.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 547f7f9..7bf529f 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -1089,8 +1089,7 @@ void __init debug_objects_mem_init(void)
if (!obj_cache || debug_objects_replace_static_objects()) {
debug_objects_enabled = 0;
- if (obj_cache)
- kmem_cache_destroy(obj_cache);
+ kmem_cache_destroy(obj_cache);
pr_warn("out of memory.\n");
} else
debug_objects_selftest();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 18/39] whci: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-45@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/usb/host/whci/init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/host/whci/init.c b/drivers/usb/host/whci/init.c index d3e13b6..e363723 100644 --- a/drivers/usb/host/whci/init.c +++ b/drivers/usb/host/whci/init.c @@ -175,8 +175,7 @@ void whc_clean_up(struct whc *whc) pzl_clean_up(whc); asl_clean_up(whc); - if (whc->qset_pool) - dma_pool_destroy(whc->qset_pool); + dma_pool_destroy(whc->qset_pool); len = resource_size(&whc->umc->resource); if (whc->base) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 05/39] xhci: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-43@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/usb/host/xhci-mem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 9a8c936..40618d1 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1829,24 +1829,20 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) for (i = 1; i < MAX_HC_SLOTS; ++i) xhci_free_virt_device(xhci, i); - if (xhci->segment_pool) - dma_pool_destroy(xhci->segment_pool); + dma_pool_destroy(xhci->segment_pool); xhci->segment_pool = NULL; xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed segment pool"); - if (xhci->device_pool) - dma_pool_destroy(xhci->device_pool); + dma_pool_destroy(xhci->device_pool); xhci->device_pool = NULL; xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed device context pool"); - if (xhci->small_streams_pool) - dma_pool_destroy(xhci->small_streams_pool); + dma_pool_destroy(xhci->small_streams_pool); xhci->small_streams_pool = NULL; xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed small stream array pool"); - if (xhci->medium_streams_pool) - dma_pool_destroy(xhci->medium_streams_pool); + dma_pool_destroy(xhci->medium_streams_pool); xhci->medium_streams_pool = NULL; xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed medium stream array pool"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 27/39] ocfs2: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-47@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x;
@@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
@@
expression x;
@@
-if (x != NULL) {
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
x = NULL;
-}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/ocfs2/dlm/dlmlock.c | 3 +--
fs/ocfs2/dlm/dlmmaster.c | 16 +++++-----------
fs/ocfs2/super.c | 18 ++++++------------
fs/ocfs2/uptodate.c | 3 +--
4 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index 82e17b0..78f09c7 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -633,6 +633,5 @@ int __init init_ocfs2_uptodate_cache(void)
void exit_ocfs2_uptodate_cache(void)
{
- if (ocfs2_uptodate_cachep)
- kmem_cache_destroy(ocfs2_uptodate_cachep);
+ kmem_cache_destroy(ocfs2_uptodate_cachep);
}
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 46b8b2b..eb53b98 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -414,8 +414,7 @@ int dlm_init_mle_cache(void)
void dlm_destroy_mle_cache(void)
{
- if (dlm_mle_cache)
- kmem_cache_destroy(dlm_mle_cache);
+ kmem_cache_destroy(dlm_mle_cache);
}
static void dlm_mle_release(struct kref *kref)
@@ -472,15 +471,10 @@ bail:
void dlm_destroy_master_caches(void)
{
- if (dlm_lockname_cache) {
- kmem_cache_destroy(dlm_lockname_cache);
- dlm_lockname_cache = NULL;
- }
-
- if (dlm_lockres_cache) {
- kmem_cache_destroy(dlm_lockres_cache);
- dlm_lockres_cache = NULL;
- }
+ kmem_cache_destroy(dlm_lockname_cache);
+ dlm_lockname_cache = NULL;
+ kmem_cache_destroy(dlm_lockres_cache);
+ dlm_lockres_cache = NULL;
}
static void dlm_lockres_release(struct kref *kref)
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c
index 66c2a49..7496231 100644
--- a/fs/ocfs2/dlm/dlmlock.c
+++ b/fs/ocfs2/dlm/dlmlock.c
@@ -77,8 +77,7 @@ int dlm_init_lock_cache(void)
void dlm_destroy_lock_cache(void)
{
- if (dlm_lock_cache)
- kmem_cache_destroy(dlm_lock_cache);
+ kmem_cache_destroy(dlm_lock_cache);
}
/* Tell us whether we can grant a new lock request.
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 2de4c8a..88396d2 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1786,12 +1786,9 @@ static int ocfs2_initialize_mem_caches(void)
NULL);
if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep ||
!ocfs2_qf_chunk_cachep) {
- if (ocfs2_inode_cachep)
- kmem_cache_destroy(ocfs2_inode_cachep);
- if (ocfs2_dquot_cachep)
- kmem_cache_destroy(ocfs2_dquot_cachep);
- if (ocfs2_qf_chunk_cachep)
- kmem_cache_destroy(ocfs2_qf_chunk_cachep);
+ kmem_cache_destroy(ocfs2_inode_cachep);
+ kmem_cache_destroy(ocfs2_dquot_cachep);
+ kmem_cache_destroy(ocfs2_qf_chunk_cachep);
return -ENOMEM;
}
@@ -1805,16 +1802,13 @@ static void ocfs2_free_mem_caches(void)
* destroy cache.
*/
rcu_barrier();
- if (ocfs2_inode_cachep)
- kmem_cache_destroy(ocfs2_inode_cachep);
+ kmem_cache_destroy(ocfs2_inode_cachep);
ocfs2_inode_cachep = NULL;
- if (ocfs2_dquot_cachep)
- kmem_cache_destroy(ocfs2_dquot_cachep);
+ kmem_cache_destroy(ocfs2_dquot_cachep);
ocfs2_dquot_cachep = NULL;
- if (ocfs2_qf_chunk_cachep)
- kmem_cache_destroy(ocfs2_qf_chunk_cachep);
+ kmem_cache_destroy(ocfs2_qf_chunk_cachep);
ocfs2_qf_chunk_cachep = NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 28/39] ecryptfs: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-55@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- fs/ecryptfs/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 4f4d047..e83f31c 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -737,8 +737,7 @@ static void ecryptfs_free_kmem_caches(void) struct ecryptfs_cache_info *info; info = &ecryptfs_cache_infos[i]; - if (*(info->cache)) - kmem_cache_destroy(*(info->cache)); + kmem_cache_destroy(*(info->cache)); } } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tyler Hicks <tyhicks@canonical.com> |
|---|---|
| Date | 2015-09-15 04:10 +0200 |
| Subject | Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions |
| Message-ID | <q8NR0-7HD-13@gated-at.bofh.it> |
| In reply to | #1223662 |
[Multipart message — attachments visible in raw view] — view raw
On 2015-09-13 14:15:21, Julia Lawall wrote: > Remove unneeded NULL test. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) > > // <smpl> > @@ expression x; @@ > -if (x != NULL) > \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Tyler Hicks <tyhicks@canonical.com> I assume that you'll be landing this patch set into Linus' tree all together. Let me know if that's incorrect and I should take this single patch into the eCryptfs dev tree. Thanks! Tyler > > --- > fs/ecryptfs/main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c > index 4f4d047..e83f31c 100644 > --- a/fs/ecryptfs/main.c > +++ b/fs/ecryptfs/main.c > @@ -737,8 +737,7 @@ static void ecryptfs_free_kmem_caches(void) > struct ecryptfs_cache_info *info; > > info = &ecryptfs_cache_infos[i]; > - if (*(info->cache)) > - kmem_cache_destroy(*(info->cache)); > + kmem_cache_destroy(*(info->cache)); > } > } > >
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-09-15 06:40 +0200 |
| Subject | Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions |
| Message-ID | <q8Qc9-2AA-3@gated-at.bofh.it> |
| In reply to | #1224592 |
On Mon, 14 Sep 2015, Tyler Hicks wrote: > On 2015-09-13 14:15:21, Julia Lawall wrote: > > Remove unneeded NULL test. > > > > The semantic patch that makes this change is as follows: > > (http://coccinelle.lip6.fr/) > > > > // <smpl> > > @@ expression x; @@ > > -if (x != NULL) > > \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); > > // </smpl> > > > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > Acked-by: Tyler Hicks <tyhicks@canonical.com> > > I assume that you'll be landing this patch set into Linus' tree all > together. Let me know if that's incorrect and I should take this single > patch into the eCryptfs dev tree. I'm not doing anythign after this point. Some others have taken the patch into their trees. julia > > Thanks! > > Tyler > > > > > --- > > fs/ecryptfs/main.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c > > index 4f4d047..e83f31c 100644 > > --- a/fs/ecryptfs/main.c > > +++ b/fs/ecryptfs/main.c > > @@ -737,8 +737,7 @@ static void ecryptfs_free_kmem_caches(void) > > struct ecryptfs_cache_info *info; > > > > info = &ecryptfs_cache_infos[i]; > > - if (*(info->cache)) > > - kmem_cache_destroy(*(info->cache)); > > + kmem_cache_destroy(*(info->cache)); > > } > > } > > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tyler Hicks <tyhicks@canonical.com> |
|---|---|
| Date | 2015-09-15 16:50 +0200 |
| Subject | Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions |
| Message-ID | <q8ZIv-7Nu-45@gated-at.bofh.it> |
| In reply to | #1224638 |
[Multipart message — attachments visible in raw view] — view raw
On 2015-09-15 06:36:30, Julia Lawall wrote: > > > On Mon, 14 Sep 2015, Tyler Hicks wrote: > > > On 2015-09-13 14:15:21, Julia Lawall wrote: > > > Remove unneeded NULL test. > > > > > > The semantic patch that makes this change is as follows: > > > (http://coccinelle.lip6.fr/) > > > > > > // <smpl> > > > @@ expression x; @@ > > > -if (x != NULL) > > > \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); > > > // </smpl> > > > > > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > > > Acked-by: Tyler Hicks <tyhicks@canonical.com> > > > > I assume that you'll be landing this patch set into Linus' tree all > > together. Let me know if that's incorrect and I should take this single > > patch into the eCryptfs dev tree. > > I'm not doing anythign after this point. Some others have taken the patch > into their trees. I've taken it into my tree. Thanks again. Tyler > > julia > > > > > Thanks! > > > > Tyler > > > > > > > > --- > > > fs/ecryptfs/main.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c > > > index 4f4d047..e83f31c 100644 > > > --- a/fs/ecryptfs/main.c > > > +++ b/fs/ecryptfs/main.c > > > @@ -737,8 +737,7 @@ static void ecryptfs_free_kmem_caches(void) > > > struct ecryptfs_cache_info *info; > > > > > > info = &ecryptfs_cache_infos[i]; > > > - if (*(info->cache)) > > > - kmem_cache_destroy(*(info->cache)); > > > + kmem_cache_destroy(*(info->cache)); > > > } > > > } > > > > > > > > > -- > To unsubscribe from this list: send the line "unsubscribe ecryptfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 07/39] fs: ext4: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-49@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@ expression x; @@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/ext4/crypto.c | 9 +++------
fs/ext4/extents_status.c | 3 +--
fs/ext4/mballoc.c | 3 +--
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 26724ae..42096d3 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -161,8 +161,7 @@ int __init ext4_init_es(void)
void ext4_exit_es(void)
{
- if (ext4_es_cachep)
- kmem_cache_destroy(ext4_es_cachep);
+ kmem_cache_destroy(ext4_es_cachep);
}
void ext4_es_init_tree(struct ext4_es_tree *tree)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 34b610e..b5adfb9 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2520,8 +2520,7 @@ static void ext4_groupinfo_destroy_slabs(void)
int i;
for (i = 0; i < NR_GRPINFO_CACHES; i++) {
- if (ext4_groupinfo_caches[i])
- kmem_cache_destroy(ext4_groupinfo_caches[i]);
+ kmem_cache_destroy(ext4_groupinfo_caches[i]);
ext4_groupinfo_caches[i] = NULL;
}
}
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index 4573155..e4d6d30 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -153,17 +153,14 @@ void ext4_exit_crypto(void)
list_for_each_entry_safe(pos, n, &ext4_free_crypto_ctxs, free_list)
kmem_cache_free(ext4_crypto_ctx_cachep, pos);
INIT_LIST_HEAD(&ext4_free_crypto_ctxs);
- if (ext4_bounce_page_pool)
- mempool_destroy(ext4_bounce_page_pool);
+ mempool_destroy(ext4_bounce_page_pool);
ext4_bounce_page_pool = NULL;
if (ext4_read_workqueue)
destroy_workqueue(ext4_read_workqueue);
ext4_read_workqueue = NULL;
- if (ext4_crypto_ctx_cachep)
- kmem_cache_destroy(ext4_crypto_ctx_cachep);
+ kmem_cache_destroy(ext4_crypto_ctx_cachep);
ext4_crypto_ctx_cachep = NULL;
- if (ext4_crypt_info_cachep)
- kmem_cache_destroy(ext4_crypt_info_cachep);
+ kmem_cache_destroy(ext4_crypt_info_cachep);
ext4_crypt_info_cachep = NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 30/39] block: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-57@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@ expression x; @@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
block/bio-integrity.c | 7 ++-----
block/bio.c | 7 ++-----
block/blk-core.c | 3 +--
block/elevator.c | 3 +--
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 84d6394..e3e9021 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -847,8 +847,7 @@ int elv_register(struct elevator_type *e)
spin_lock(&elv_list_lock);
if (elevator_find(e->elevator_name)) {
spin_unlock(&elv_list_lock);
- if (e->icq_cache)
- kmem_cache_destroy(e->icq_cache);
+ kmem_cache_destroy(e->icq_cache);
return -EBUSY;
}
list_add_tail(&e->list, &elv_list);
diff --git a/block/bio.c b/block/bio.c
index ad3f276..aee3290 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1850,11 +1850,8 @@ void bioset_free(struct bio_set *bs)
if (bs->rescue_workqueue)
destroy_workqueue(bs->rescue_workqueue);
- if (bs->bio_pool)
- mempool_destroy(bs->bio_pool);
-
- if (bs->bvec_pool)
- mempool_destroy(bs->bvec_pool);
+ mempool_destroy(bs->bio_pool);
+ mempool_destroy(bs->bvec_pool);
bioset_integrity_free(bs);
bio_put_slab(bs);
diff --git a/block/blk-core.c b/block/blk-core.c
index 2eb722d..7dbebd9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -619,8 +619,7 @@ int blk_init_rl(struct request_list *rl, struct request_queue *q,
void blk_exit_rl(struct request_list *rl)
{
- if (rl->rq_pool)
- mempool_destroy(rl->rq_pool);
+ mempool_destroy(rl->rq_pool);
}
struct request_queue *blk_alloc_queue(gfp_t gfp_mask)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 4aecca7..d3e3046 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -490,11 +490,8 @@ EXPORT_SYMBOL(bioset_integrity_create);
void bioset_integrity_free(struct bio_set *bs)
{
- if (bs->bio_integrity_pool)
- mempool_destroy(bs->bio_integrity_pool);
-
- if (bs->bvec_integrity_pool)
- mempool_destroy(bs->bvec_integrity_pool);
+ mempool_destroy(bs->bio_integrity_pool);
+ mempool_destroy(bs->bvec_integrity_pool);
}
EXPORT_SYMBOL(bioset_integrity_free);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 13/39] staging: lustre: drop null test before destroy functions |
| Message-ID | <q8eJC-7J8-61@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x;
@@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
@@
expression x;
@@
-if (x != NULL) {
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
x = NULL;
-}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/staging/lustre/lustre/llite/super25.c | 16 +++-----------
drivers/staging/lustre/lustre/obdclass/genops.c | 24 +++++++--------------
drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +----
3 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index 8e47232..e8101fe 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -2052,10 +2052,8 @@ EXPORT_SYMBOL(lu_kmem_init);
void lu_kmem_fini(struct lu_kmem_descr *caches)
{
for (; caches->ckd_cache != NULL; ++caches) {
- if (*caches->ckd_cache != NULL) {
- kmem_cache_destroy(*caches->ckd_cache);
- *caches->ckd_cache = NULL;
- }
+ kmem_cache_destroy(*caches->ckd_cache);
+ *caches->ckd_cache = NULL;
}
}
EXPORT_SYMBOL(lu_kmem_fini);
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 0ca7309..ad78a04 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -638,22 +638,14 @@ EXPORT_SYMBOL(class_notify_sptlrpc_conf);
void obd_cleanup_caches(void)
{
- if (obd_device_cachep) {
- kmem_cache_destroy(obd_device_cachep);
- obd_device_cachep = NULL;
- }
- if (obdo_cachep) {
- kmem_cache_destroy(obdo_cachep);
- obdo_cachep = NULL;
- }
- if (import_cachep) {
- kmem_cache_destroy(import_cachep);
- import_cachep = NULL;
- }
- if (capa_cachep) {
- kmem_cache_destroy(capa_cachep);
- capa_cachep = NULL;
- }
+ kmem_cache_destroy(obd_device_cachep);
+ obd_device_cachep = NULL;
+ kmem_cache_destroy(obdo_cachep);
+ obdo_cachep = NULL;
+ kmem_cache_destroy(import_cachep);
+ import_cachep = NULL;
+ kmem_cache_destroy(capa_cachep);
+ capa_cachep = NULL;
}
int obd_init_caches(void)
diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c
index e4020ce..4cf7af2 100644
--- a/drivers/staging/lustre/lustre/llite/super25.c
+++ b/drivers/staging/lustre/lustre/llite/super25.c
@@ -183,18 +183,10 @@ out_sysfs:
out_debugfs:
debugfs_remove(llite_root);
out_cache:
- if (ll_inode_cachep != NULL)
- kmem_cache_destroy(ll_inode_cachep);
-
- if (ll_file_data_slab != NULL)
- kmem_cache_destroy(ll_file_data_slab);
-
- if (ll_remote_perm_cachep != NULL)
- kmem_cache_destroy(ll_remote_perm_cachep);
-
- if (ll_rmtperm_hash_cachep != NULL)
- kmem_cache_destroy(ll_rmtperm_hash_cachep);
-
+ kmem_cache_destroy(ll_inode_cachep);
+ kmem_cache_destroy(ll_file_data_slab);
+ kmem_cache_destroy(ll_remote_perm_cachep);
+ kmem_cache_destroy(ll_rmtperm_hash_cachep);
return rc;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 29/39] thunderbolt: drop null test before destroy functions |
| Message-ID | <q8eJD-7J8-69@gated-at.bofh.it> |
| In reply to | #1223657 |
Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/thunderbolt/ctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 799634b..163b283 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -530,8 +530,7 @@ void tb_ctl_free(struct tb_ctl *ctl) tb_ctl_pkg_free(ctl->rx_packets[i]); - if (ctl->frame_pool) - dma_pool_destroy(ctl->frame_pool); + dma_pool_destroy(ctl->frame_pool); kfree(ctl); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-09-14 14:00 +0200 |
| Message-ID | <q8AAr-5jh-41@gated-at.bofh.it> |
| In reply to | #1223657 |
> Recent commits to kernel/git/torvalds/linux.git have made the following > functions able to tolerate NULL arguments: > > kmem_cache_destroy (commit 3942d29918522) > mempool_destroy (commit 4e3ca3e033d1) > dma_pool_destroy (commit 44d7175da6ea) How do you think about to extend an other SmPL script? Related topic: scripts/coccinelle/free: Delete NULL test before freeing functions https://systeme.lip6.fr/pipermail/cocci/2015-May/001960.html https://www.mail-archive.com/cocci@systeme.lip6.fr/msg01855.html > If these changes are OK, I will address the remainder later. Would anybody like to reuse my general SmPL approach for similar source code clean-up? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web