mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yan Hong <clouds.yan@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] debugfs: remove redundant check in __debugfs_remove()
Date: Sat, 27 Oct 2012 16:05:28 +0800	[thread overview]
Message-ID: <1351325129-10097-4-git-send-email-clouds.yan@gmail.com> (raw)
In-Reply-To: <1351325129-10097-1-git-send-email-clouds.yan@gmail.com>

debugfs_positive() already checked dentry->d_inode is
not NUUL, no need to check it again.

Signed-off-by: Yan Hong <clouds.yan@gmail.com>
---
 fs/debugfs/inode.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 12f1282..58eadc1 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -463,23 +463,21 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
 	int ret = 0;
 
 	if (debugfs_positive(dentry)) {
-		if (dentry->d_inode) {
-			dget(dentry);
-			switch (dentry->d_inode->i_mode & S_IFMT) {
-			case S_IFDIR:
-				ret = simple_rmdir(parent->d_inode, dentry);
-				break;
-			case S_IFLNK:
-				kfree(dentry->d_inode->i_private);
-				/* fall through */
-			default:
-				simple_unlink(parent->d_inode, dentry);
-				break;
-			}
-			if (!ret)
-				d_delete(dentry);
-			dput(dentry);
+		dget(dentry);
+		switch (dentry->d_inode->i_mode & S_IFMT) {
+		case S_IFDIR:
+			ret = simple_rmdir(parent->d_inode, dentry);
+			break;
+		case S_IFLNK:
+			kfree(dentry->d_inode->i_private);
+			/* fall through */
+		default:
+			simple_unlink(parent->d_inode, dentry);
+			break;
 		}
+		if (!ret)
+			d_delete(dentry);
+		dput(dentry);
 	}
 	return ret;
 }
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-27  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-27  8:05 [PATCH 1/5] debugfs: pass NULL as the last parameter of debugfs_print_regs32() Yan Hong
2012-10-27  8:05 ` [PATCH 2/5] debugfs: return directly if failed to allocate memory in debug_fill_super() Yan Hong
2012-10-27  8:05 ` [PATCH 3/5] debugfs: remove redundant initialization in __create_file() Yan Hong
2012-10-27  8:05 ` Yan Hong [this message]
2012-10-27  8:05 ` [PATCH 5/5] debugfs: remove goto in debugfs_remount() Yan Hong
2012-10-27 15:06   ` Greg KH
2012-10-27 16:19     ` Yan Hong
2012-10-27 15:07 ` [PATCH 1/5] debugfs: pass NULL as the last parameter of debugfs_print_regs32() Greg KH
2012-10-27 15:45 ` Alessandro Rubini
2012-10-27 16:03   ` Greg KH

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=1351325129-10097-4-git-send-email-clouds.yan@gmail.com \
    --to=clouds.yan@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --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

Powered by JetHome