public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Himangi Saraogi <himangi774@gmail.com>
To: Tyler Hicks <tyhicks@canonical.com>,
	ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr, Joe Perches <joe@perches.com>
Subject: [PATCH v2] ecryptfs: Drop cast
Date: Fri, 27 Jun 2014 01:11:59 +0530	[thread overview]
Message-ID: <20140626194159.GA7163@himangi-Dell> (raw)

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>
---
v2: remove the if statement
 fs/ecryptfs/inode.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 4d6c7e4..e67f9f0 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -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)
-- 
1.9.1


             reply	other threads:[~2014-06-26 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 19:41 Himangi Saraogi [this message]
2014-06-26 19:50 ` [PATCH v2] ecryptfs: Drop cast Tyler Hicks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140626194159.GA7163@himangi-Dell \
    --to=himangi774@gmail.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=joe@perches.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tyhicks@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox