Skip to contentSkip to conversation

ocfs2: delete double assignment

PATCH In review Himangi Saraogi 2 participants 2 messages Jul 28, 2014 – Aug 21, 2014 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: delete double assignment

Delete successive assignments to the same location. The two assignments are simply identical.

A simplified version of Coccinelle semantic match that finds this problem is as follows:

// <smpl>
@@
expression i;
@@

*i = ...;
i = ...;
// </smpl>

---
Should the fist assignment be initializing the pv_minor field?

 fs/ocfs2/stack_user.c | 1 -
 1 file changed, 1 deletion(-)
fs/ocfs2/stack_user.c +0 -1
index 13a8537..4bcbb9b 100644
@@ -591,7 +591,6 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
 		 */
 		ocfs2_control_this_node = -1;
 		running_proto.pv_major = 0;
-		running_proto.pv_major = 0;
 	}
 
 out:
Signature · 1 line
1.9.1
#1 lore raw
Quoted 11 lines · On Mon, 28 Jul 2014 20:56:32 +0530 Himangi Saraogi <[email protected]> wrote:

Delete successive assignments to the same location. The two assignments are simply identical.

A simplified version of Coccinelle semantic match that finds this problem is as follows:

// <smpl>
@@
expression i;
@@

Quoted 7 lines

*i = ...;
i = ...;
// </smpl>

---
Should the fist assignment be initializing the pv_minor field?

I'd say so, yes.

From: Andrew Morton <[email protected]>
Subject: fs/ocfs2/stack_user.c: fix typo in ocfs2_control_release()

It is supposed to zero pv_minor.

---

 fs/ocfs2/stack_user.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/stack_user.c renamed from fs/ocfs2/stack_user.c~fs-ocfs2-stack_userc-fix-typo-in-ocfs2_control_release +1 -1
diff -puN fs/ocfs2/stack_user.c~fs-ocfs2-stack_userc-fix-typo-in-ocfs2_control_release fs/ocfs2/stack_user.c
@@ -591,7 +591,7 @@ static int ocfs2_control_release(struct
 		 */
 		ocfs2_control_this_node = -1;
 		running_proto.pv_major = 0;
-		running_proto.pv_major = 0;
+		running_proto.pv_minor = 0;
 	}
 
 out:

_