ecryptfs: Drop cast
authorHimangi Saraogi <himangi774@gmail.com>
Thu, 26 Jun 2014 19:41:59 +0000 (01:11 +0530)
committerTyler Hicks <tyhicks@canonical.com>
Thu, 3 Jul 2014 21:37:56 +0000 (16:37 -0500)
This patch does away with cast on void * and the if as it is 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
)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
fs/ecryptfs/inode.c

index 87ad33e091e9f79fa68e71630bced978119a4a2b..a27121d35b231c76e4de81f87248fd6e5c7375f5 100644 (file)
@@ -53,9 +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)
-               return 1;
-       return 0;
+       return ecryptfs_inode_to_lower(inode) == lower_inode;
 }
 
 static int ecryptfs_inode_set(struct inode *inode, void *opaque)