Skip to contentSkip to conversation

ecryptfs: Drop cast

PATCH Superseded Himangi Saraogi 2 participants 2 messages Jun 26, 2014 Ecrypt file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ecryptfs: Drop cast

This patch does away with casts on void * as they are unnecessary.

The following Coccinelle semantic patch was used for making the change:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 fs/ecryptfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ecryptfs/inode.c +1 -1
index 4d6c7e4..5459792 100644
@@ -53,7 +53,7 @@ static void unlock_dir(struct dentry *dir)
 
 static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
 {
-	if (ecryptfs_inode_to_lower(inode) == (struct inode *)lower_inode)
+	if (ecryptfs_inode_to_lower(inode) == lower_inode)
 		return 1;
 	return 0;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 1 line · Himangi Saraogi

This patch does away with casts on void * as they are unnecessary.

[]

fs/ecryptfs/inode.c

Quoted 1 line
fs/ecryptfs/inode.c +0 -0

[]

fs/ecryptfs/inode.c static void unlock_dir(struct dentry *dir) · line 59

Quoted 9 lines
fs/ecryptfs/inode.c +1 -1
@@ -53,7 +53,7 @@ static void unlock_dir(struct dentry *dir)
 
 static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
 {
-	if (ecryptfs_inode_to_lower(inode) == (struct inode *)lower_inode)
+	if (ecryptfs_inode_to_lower(inode) == lower_inode)
 		return 1;
 	return 0;
 }

True, but perhaps this should be

{
	return ecryptfs_inode_to_lower(inode) == lower_inode;
}