* [PATCH 00/39] drop null test before destroy functions
@ 2015-09-13 12:14 Julia Lawall
2015-09-13 12:14 ` [PATCH 01/39] mtd: nandsim: " Julia Lawall
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Julia Lawall @ 2015-09-13 12:14 UTC (permalink / raw)
To: iommu, dccp, dri-devel, intel-gfx, ecryptfs, dmaengine
Cc: sergey.senozhatsky, kernel-janitors, Dan Williams, cluster-devel,
intel-wired-lan, Mitch Williams, John Ronciak, Matthew Vick,
Don Skidmore, Carolyn Wyborny, Shannon Nelson, Jesse Brandeburg,
linux-nfs, linux-raid, netdev, linux-atm-general, linux-btrfs,
linux-nilfs, linux-kernel, linux-mtd, linux-usb, linux-ext4,
linux-rdma, devel, HPDD-discuss, linux-bcache, drbd-user,
ocfs2-devel, kvm, ceph-devel, Chao Yu, linux-f2fs-devel
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(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 01/39] mtd: nandsim: drop null test before destroy functions
2015-09-13 12:14 [PATCH 00/39] drop null test before destroy functions Julia Lawall
@ 2015-09-13 12:14 ` Julia Lawall
2015-09-22 0:07 ` Brian Norris
2015-09-13 12:15 ` [PATCH 23/39] UBI: " Julia Lawall
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2015-09-13 12:14 UTC (permalink / raw)
To: David Woodhouse
Cc: sergey.senozhatsky, kernel-janitors, Brian Norris, linux-mtd,
linux-kernel
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/mtd/nand/nandsim.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 95d0cc4..b16d70a 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -649,8 +649,7 @@ static void free_device(struct nandsim *ns)
kmem_cache_free(ns->nand_pages_slab,
ns->pages[i].byte);
}
- if (ns->nand_pages_slab)
- kmem_cache_destroy(ns->nand_pages_slab);
+ kmem_cache_destroy(ns->nand_pages_slab);
vfree(ns->pages);
}
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 23/39] UBI: drop null test before destroy functions
2015-09-13 12:14 [PATCH 00/39] drop null test before destroy functions Julia Lawall
2015-09-13 12:14 ` [PATCH 01/39] mtd: nandsim: " Julia Lawall
@ 2015-09-13 12:15 ` Julia Lawall
2015-10-03 18:36 ` Richard Weinberger
2015-09-13 12:15 ` [PATCH 36/39] jffs2: " Julia Lawall
2015-09-14 11:55 ` [PATCH 00/39] " SF Markus Elfring
3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2015-09-13 12:15 UTC (permalink / raw)
To: Artem Bityutskiy
Cc: sergey.senozhatsky, kernel-janitors, Richard Weinberger,
David Woodhouse, Brian Norris, linux-mtd, linux-kernel
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/mtd/ubi/attach.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 68eea5b..c1aaf03 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1209,9 +1209,7 @@ static void destroy_ai(struct ubi_attach_info *ai)
}
}
- if (ai->aeb_slab_cache)
- kmem_cache_destroy(ai->aeb_slab_cache);
-
+ kmem_cache_destroy(ai->aeb_slab_cache);
kfree(ai);
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 36/39] jffs2: drop null test before destroy functions
2015-09-13 12:14 [PATCH 00/39] drop null test before destroy functions Julia Lawall
2015-09-13 12:14 ` [PATCH 01/39] mtd: nandsim: " Julia Lawall
2015-09-13 12:15 ` [PATCH 23/39] UBI: " Julia Lawall
@ 2015-09-13 12:15 ` Julia Lawall
2015-09-14 11:55 ` [PATCH 00/39] " SF Markus Elfring
3 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2015-09-13 12:15 UTC (permalink / raw)
To: David Woodhouse
Cc: sergey.senozhatsky, kernel-janitors, linux-mtd, linux-kernel
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/jffs2/malloc.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index b8fd651..ce11897 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -97,25 +97,16 @@ int __init jffs2_create_slab_caches(void)
void jffs2_destroy_slab_caches(void)
{
- if(full_dnode_slab)
- kmem_cache_destroy(full_dnode_slab);
- if(raw_dirent_slab)
- kmem_cache_destroy(raw_dirent_slab);
- if(raw_inode_slab)
- kmem_cache_destroy(raw_inode_slab);
- if(tmp_dnode_info_slab)
- kmem_cache_destroy(tmp_dnode_info_slab);
- if(raw_node_ref_slab)
- kmem_cache_destroy(raw_node_ref_slab);
- if(node_frag_slab)
- kmem_cache_destroy(node_frag_slab);
- if(inode_cache_slab)
- kmem_cache_destroy(inode_cache_slab);
+ kmem_cache_destroy(full_dnode_slab);
+ kmem_cache_destroy(raw_dirent_slab);
+ kmem_cache_destroy(raw_inode_slab);
+ kmem_cache_destroy(tmp_dnode_info_slab);
+ kmem_cache_destroy(raw_node_ref_slab);
+ kmem_cache_destroy(node_frag_slab);
+ kmem_cache_destroy(inode_cache_slab);
#ifdef CONFIG_JFFS2_FS_XATTR
- if (xattr_datum_cache)
- kmem_cache_destroy(xattr_datum_cache);
- if (xattr_ref_cache)
- kmem_cache_destroy(xattr_ref_cache);
+ kmem_cache_destroy(xattr_datum_cache);
+ kmem_cache_destroy(xattr_ref_cache);
#endif
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 00/39] drop null test before destroy functions
2015-09-13 12:14 [PATCH 00/39] drop null test before destroy functions Julia Lawall
` (2 preceding siblings ...)
2015-09-13 12:15 ` [PATCH 36/39] jffs2: " Julia Lawall
@ 2015-09-14 11:55 ` SF Markus Elfring
3 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2015-09-14 11:55 UTC (permalink / raw)
To: Julia Lawall, kernel-janitors
Cc: iommu, dccp, dri-devel, intel-gfx, ecryptfs, dmaengine,
sergey.senozhatsky, Dan Williams, cluster-devel, intel-wired-lan,
Mitch Williams, John Ronciak, Matthew Vick, Don Skidmore,
Carolyn Wyborny, Shannon Nelson, Jesse Brandeburg, linux-nfs,
linux-raid, netdev, linux-atm-general, linux-btrfs, linux-nilfs,
linux-kernel, linux-mtd, linux-usb, linux-ext4, linux-rdma, devel,
HPDD-discuss, linux-bcache, drbd-user, ocfs2-devel, kvm,
ceph-devel, Chao Yu, linux-f2fs-devel
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 01/39] mtd: nandsim: drop null test before destroy functions
2015-09-13 12:14 ` [PATCH 01/39] mtd: nandsim: " Julia Lawall
@ 2015-09-22 0:07 ` Brian Norris
0 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2015-09-22 0:07 UTC (permalink / raw)
To: Julia Lawall
Cc: David Woodhouse, sergey.senozhatsky, kernel-janitors, linux-mtd,
linux-kernel
On Sun, Sep 13, 2015 at 02:14:54PM +0200, 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>
Applied patches 1 and 36 to l2-mtd.git
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 23/39] UBI: drop null test before destroy functions
2015-09-13 12:15 ` [PATCH 23/39] UBI: " Julia Lawall
@ 2015-10-03 18:36 ` Richard Weinberger
0 siblings, 0 replies; 7+ messages in thread
From: Richard Weinberger @ 2015-10-03 18:36 UTC (permalink / raw)
To: Julia Lawall, Artem Bityutskiy
Cc: sergey.senozhatsky, kernel-janitors, David Woodhouse,
Brian Norris, linux-mtd, linux-kernel
Am 13.09.2015 um 14:15 schrieb Julia Lawall:
> 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/mtd/ubi/attach.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
> index 68eea5b..c1aaf03 100644
> --- a/drivers/mtd/ubi/attach.c
> +++ b/drivers/mtd/ubi/attach.c
> @@ -1209,9 +1209,7 @@ static void destroy_ai(struct ubi_attach_info *ai)
> }
> }
>
> - if (ai->aeb_slab_cache)
> - kmem_cache_destroy(ai->aeb_slab_cache);
> -
> + kmem_cache_destroy(ai->aeb_slab_cache);
> kfree(ai);
> }
Applied!
Thanks,
//richard
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-10-03 18:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-13 12:14 [PATCH 00/39] drop null test before destroy functions Julia Lawall
2015-09-13 12:14 ` [PATCH 01/39] mtd: nandsim: " Julia Lawall
2015-09-22 0:07 ` Brian Norris
2015-09-13 12:15 ` [PATCH 23/39] UBI: " Julia Lawall
2015-10-03 18:36 ` Richard Weinberger
2015-09-13 12:15 ` [PATCH 36/39] jffs2: " Julia Lawall
2015-09-14 11:55 ` [PATCH 00/39] " SF Markus Elfring
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).