public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@canonical.com>
To: Himangi Saraogi <himangi774@gmail.com>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	julia.lawall@lip6.fr, Joe Perches <joe@perches.com>
Subject: Re: [PATCH v2] ecryptfs: Drop cast
Date: Thu, 26 Jun 2014 14:50:52 -0500	[thread overview]
Message-ID: <20140626195051.GB22973@boyd> (raw)
In-Reply-To: <20140626194159.GA7163@himangi-Dell>

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

On 2014-06-27 01:11:59, Himangi Saraogi wrote:
> 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(-)

Thanks! This looks good to me. I'll take the patch from here.

Tyler

> 
> 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
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

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

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=20140626195051.GB22973@boyd \
    --to=tyhicks@canonical.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=himangi774@gmail.com \
    --cc=joe@perches.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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