[PATCH] fs/pnode.c: Simplify code

From: Christophe JAILLET
Date: Sat Sep 03 2016 - 01:34:50 EST


Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to
'list_splice_init'.

This has been spotted with the following coccinelle script:
/////
@@
expression y,z;
@@

- list_splice(y,z);
- INIT_LIST_HEAD(y);
+ list_splice_init(y,z);

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
fs/pnode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pnode.c b/fs/pnode.c
index 99899705b105..3d3513ee4380 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -97,8 +97,8 @@ static int do_make_slave(struct mount *mnt)
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
slave_mnt->mnt_master = master;
list_move(&mnt->mnt_slave, &master->mnt_slave_list);
- list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
- INIT_LIST_HEAD(&mnt->mnt_slave_list);
+ list_splice_init(&mnt->mnt_slave_list,
+ master->mnt_slave_list.prev);
} else {
struct list_head *p = &mnt->mnt_slave_list;
while (!list_empty(p)) {
--
2.7.4